[Cryptography] WIPEONFORK in Linux 4.14

Nico Williams nico at cryptonector.com
Mon Nov 27 22:19:28 EST 2017


On Mon, Nov 27, 2017 at 10:28:57PM +0100, Florian Weimer wrote:
> > Right.  One should not, however, call syscall(2) to avoid libc stubs.
> > It's very dangerous for precisely this sort of reason.
> 
> Well, historically, we have done a very poor job exposing clone(2)
> functionality in a more ready-to-use manner.  What we provide is
> geared towards creation of threads, rather than the fork/vfork-like
> interface many applications want.

Even now it's not possible to do certain things.  Setting up TLS
correctly with clone(2) without actually being inside the C library is
impossible.  I can point you at some interesting threads about that.

> >> What should work as an MADV_WIPEONFORK replacement is a MAP_SHARED
> >> mapping and two counters, [...]
> >
> > Clever.  You can also just check that (my_saved_pid == getpid()), which
> > if you have a fast getpid() via a vdso, is cheap.
> 
> Unfortunately, PIDs get reused too quickly for that:

:(


More information about the cryptography mailing list