This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] posix: Do not use WNOHANG in waitpid call for Linux posix_spawn


* Pedro Alves:

> On 10/23/2017 11:38 AM, Szabolcs Nagy wrote:
>
>> VFORK is not precise (i think under ptrace parent can
>> continue before child execs) 
>
> It can not, modulo ancient kernel bugs, perhaps.  Even if the
> ptracer PTRACE_CONTs the parent, the parent remains frozen
> in "D (disk sleep)" until the child execs or dies, at which
> point the ptracer is notified with a PTRACE_EVENT_VFORK_DONE
> event, if enabled with PTRACE_O_TRACEVFORKDONE.

What seems to happen here is that the kernel puts the exit
notification on some internal queue, where it lingers for some time,
and the clone system call returns immediately.  At this point, the
queued exit status is not visible.  I think it's a kernel bug
(potentially related to the incorrect reporting of EAGAIN from
clone/fork), but the kernel increasingly does things like that because
they look good in benchmarks.  This way, the kernel can batch multiple
deallocations to use a single (global) synchronization, which is
cheaper.  But it also means that any kind of resource accounting is
inaccurate and can fail spuriously, and it also results in bugs like
the externally synchronized waitpid not showing correct process state.

  <https://bugzilla.kernel.org/show_bug.cgi?id=154011>

I hear that namespace deallocation now has a similar bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]