[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#857909: [libc6-dev] getpid() in child process created using clone(CLONE_VM) returns parent's pid

Hi Kirill!

> My case is not in the list of the cases, described in clone(2),
> when wrong pid may be returned, so this is a BUG.

Which case in particular do you mean? From the manpage it seems that
getpid() is simply not reliable under various circumstances and that
one should always use the syscall alternative if possible:

> Versions  of  the  GNU  C library that include the NPTL threading library contain a wrapper function for getpid(2)
> that performs caching of PIDs.  This caching relies on support in the glibc wrapper for clone(), but as  currently
> implemented,  the  cache  may not be up to date in some circumstances.

Can you elaborate a bit more where your sample code contradicts the
clone(2) manpage which documents the buggy behavior?


 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

Reply to: