Robust getpid caching via MADV_WIPEONFORK?

Florian Weimer fweimer@redhat.com
Thu Dec 7 07:06:00 GMT 2017


On 11/22/2017 09:34 PM, Josh Triplett wrote:
> Given that, I wanted to start a thread about the idea of making
> getpid() caching, and for that matter other potential uses of
> pthread_atfork(), robust using MADV_WIPEONFORK when available.

One major issue with the existing PID cache was the interaction with 
vfork, for calling abort/assert from the subprocess.  MADV_WIPEONFORK 
mappings are not cleared on vfork, so such a PID cache would still 
return the wrong value in this context.

Thanks,
Florian



More information about the Libc-alpha mailing list