<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jun 25, 2018 at 4:15 PM, John-Mark Gurney <span dir="ltr"><<a href="mailto:jmg@funkthat.com" target="_blank">jmg@funkthat.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The closes platform independant method is pthread_atfork, but I don't<br>
know how well that works across various platforms...  But you can use<br>
that to trigger reseeds...<br></blockquote><div><br></div><div>It works and is worth using, but it can be evaded by VMs and other environments which may call fork()/clone() more directly. </div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
A great solution is the flag to zero a page on fork...<br>
<br>
OpenBSD, and now FreeBSD, has a flag to zero a page when the process<br>
forks...  This way you store the seed in the page, and check to make<br>
sure it's not zero, if it is, then you reseed...  This has the best<br>
protection as you will never leak seed material...<br>
<br>
See INHERIT_ZERO in:<br>
<a href="https://man.openbsd.org/minherit.2" rel="noreferrer" target="_blank">https://man.openbsd.org/<wbr>minherit.2</a><br>
and:<br>
<a href="https://www.freebsd.org/cgi/man.cgi?query=minherit&sektion=2&apropos=0&manpath=freebsd" rel="noreferrer" target="_blank">https://www.freebsd.org/cgi/<wbr>man.cgi?query=minherit&<wbr>sektion=2&apropos=0&manpath=<wbr>freebsd</a></blockquote><div><br></div><div>Linux has this too now, in the form of MMAP_WIPEONFORK. </div></div><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Colm</div>
</div></div>