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

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



Your message dated Tue, 11 Apr 2017 22:34:09 +0000
with message-id <E1cy4MT-000EDc-J3@fasolo.debian.org>
and subject line Bug#857909: fixed in glibc 2.24-10
has caused the Debian Bug report #857909,
regarding [libc6-dev] getpid() in child process created using clone(CLONE_VM) returns parent's pid
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
857909: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857909
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: libc6-dev
Version: 2.24-9
Severity: grave

Dear Maintainer,

the program below shows the problem, happening on my Debian laptop.
When I create a child using clone(CLONE_VM), glibc's clone wrapper
does not update cached pid, and I receive parent's pid in getpid().
Here is output of the program:

$strace -o strace.log -f ./a.out
parent: pid=17530
parent: fork pid=17531
1)child: pid=17531
2)child: pid=17530

When CLONE_VM flag is not passed, the problem does not occur.
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.

Regards,
Kirill

P.S. Strange, but reportbug-ng did not fill packages versions. So,
I do this manually:

$ dpkg-query -l 'libc6*'
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                          Version             Architecture        Description
+++-=============================-===================-===================-================================================================
ii  libc6:amd64                   2.24-9              amd64               GNU C Library: Shared libraries
ii  libc6:i386                    2.24-9              i386                GNU C Library: Shared libraries
ii  libc6-amd64:i386              2.24-9              i386                GNU C Library: 64bit Shared libraries for AMD64
ii  libc6-arm64-cross             2.24-9cross3        all                 GNU C Library: Shared libraries (for cross-compiling)
un  libc6-arm64-dcv1              <none>              <none>              (no description available)
ii  libc6-dbg:amd64               2.24-9              amd64               GNU C Library: detached debugging symbols
ii  libc6-dev:amd64               2.24-9              amd64               GNU C Library: Development Libraries and Header Files
ii  libc6-dev-arm64-cross         2.24-9cross3        all                 GNU C Library: Development Libraries and Header Files (for cross
un  libc6-dev-arm64-dcv1          <none>              <none>              (no description available)
ii  libc6-dev-i386                2.24-9              amd64               GNU C Library: 32-bit development libraries for AMD64
ii  libc6-dev-x32                 2.24-9              amd64               GNU C Library: X32 ABI Development Libraries for AMD64
ii  libc6-i386                    2.24-9              amd64               GNU C Library: 32-bit shared libraries for AMD64
un  libc6-i686                    <none>              <none>              (no description available)
ii  libc6-x32                     2.24-9              amd64               GNU C Library: X32 ABI Shared libraries for AMD64
un  libc6.1                       <none>              <none>              (no description available)
un  libc6.1-dev                   <none>              <none>              (no description available)
un  libc6.1-dev-arm64-cross       <none>              <none>              (no description available)


#define _GNU_SOURCE
#include <sched.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <sys/syscall.h>
#include <sys/mman.h>
#include <signal.h>

int child(void *a)
{
	printf("1)child: pid=%d\n", syscall(__NR_getpid));
	printf("2)child: pid=%d\n", getpid());
	return 0;
}

int main(void)
{
	int stack_size = 2 * 1024 * 1024;
	char *stack = mmap(NULL, stack_size, PROT_WRITE | PROT_READ, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
	pid_t pid;
	if (stack == MAP_FAILED) {
		perror("Can't allocate stack");
		exit(1);
	}

	setbuf(stdout, NULL);

	printf("parent: pid=%d\n", getpid());
	pid = clone(child, stack + stack_size, CLONE_VM | CLONE_FILES | SIGCHLD, NULL);
	printf("parent: fork pid=%d\n", pid);
}

--- System information. ---
Architecture: 
Kernel:       Linux 4.10.1+

Debian Release: 9.0
  500 unstable        ftp.ru.debian.org 
  500 testing         ftp.ru.debian.org 
  500 stable-updates  ftp.ru.debian.org 
  500 stable          security.debian.org 
  500 stable          ftp.ru.debian.org 
    1 experimental    ftp.ru.debian.org 

--- Package information. ---
Depends               (Version) | Installed
===============================-+-=============
libc6                (= 2.24-9) | 
libc-dev-bin         (= 2.24-9) | 
linux-libc-dev     (>= 4.9.2-2) | 


Package's Recommends field is empty.

Suggests          (Version) | Installed
===========================-+-===========
glibc-doc                   | 
manpages-dev                | 4.09-2
17530 execve("./a.out", ["./a.out"], [/* 48 vars */]) = 0
17530 brk(NULL)                         = 0x123e000
17530 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
17530 mmap(NULL, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb686e47000
17530 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
17530 open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 3
17530 fstat(3, {st_mode=S_IFREG|0644, st_size=190344, ...}) = 0
17530 mmap(NULL, 190344, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb686e18000
17530 close(3)                          = 0
17530 access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
17530 open("/lib/x86_64-linux-gnu/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
17530 read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\3\2\0\0\0\0\0"..., 832) = 832
17530 fstat(3, {st_mode=S_IFREG|0755, st_size=1685264, ...}) = 0
17530 mmap(NULL, 3791264, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fb686889000
17530 mprotect(0x7fb686a1e000, 2093056, PROT_NONE) = 0
17530 mmap(0x7fb686c1d000, 24576, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x194000) = 0x7fb686c1d000
17530 mmap(0x7fb686c23000, 14752, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb686c23000
17530 close(3)                          = 0
17530 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb686e16000
17530 arch_prctl(ARCH_SET_FS, 0x7fb686e16700) = 0
17530 mprotect(0x7fb686c1d000, 16384, PROT_READ) = 0
17530 mprotect(0x600000, 4096, PROT_READ) = 0
17530 mprotect(0x7fb686e4a000, 4096, PROT_READ) = 0
17530 munmap(0x7fb686e18000, 190344)    = 0
17530 mmap(NULL, 2097152, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fb686689000
17530 getpid()                          = 17530
17530 write(1, "parent: pid=17530\n", 18) = 18
17530 clone(child_stack=0x7fb686888ff0, flags=CLONE_VM|CLONE_FILES|SIGCHLD) = 17531
17531 getpid( <unfinished ...>
17530 write(1, "parent: fork pid=17531\n", 23 <unfinished ...>
17531 <... getpid resumed> )            = 17531
17530 <... write resumed> )             = 23
17530 exit_group(0)                     = ?
17531 write(1, "1)child: pid=17531\n", 19 <unfinished ...>
17530 +++ exited with 0 +++
17531 <... write resumed> )             = 19
17531 write(1, "2)child: pid=17530\n", 19) = 19
17531 exit_group(0)                     = ?
17531 +++ exited with 0 +++

--- End Message ---
--- Begin Message ---
Source: glibc
Source-Version: 2.24-10

We believe that the bug you reported is fixed in the latest version of
glibc, which is due to be installed in the Debian FTP archive.

A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 857909@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Aurelien Jarno <aurel32@debian.org> (supplier of updated glibc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@ftp-master.debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

Format: 1.8
Date: Wed, 12 Apr 2017 00:13:55 +0200
Source: glibc
Binary: libc-bin libc-dev-bin libc-l10n glibc-doc glibc-source locales locales-all nscd multiarch-support libc6 libc6-dev libc6-dbg libc6-pic libc6-udeb libc6.1 libc6.1-dev libc6.1-dbg libc6.1-pic libc6.1-udeb libc0.3 libc0.3-dev libc0.3-dbg libc0.3-pic libc0.3-udeb libc0.1 libc0.1-dev libc0.1-dbg libc0.1-pic libc0.1-udeb libc6-i386 libc6-dev-i386 libc6-sparc libc6-dev-sparc libc6-sparc64 libc6-dev-sparc64 libc6-s390 libc6-dev-s390 libc6-amd64 libc6-dev-amd64 libc6-powerpc libc6-dev-powerpc libc6-ppc64 libc6-dev-ppc64 libc6-mips32 libc6-dev-mips32 libc6-mipsn32 libc6-dev-mipsn32 libc6-mips64 libc6-dev-mips64 libc0.1-i386 libc0.1-dev-i386 libc6-x32 libc6-dev-x32 libc6-xen libc0.3-xen libc6.1-alphaev67 libc0.1-i686 libc0.3-i686 libc6-i686
Architecture: source
Version: 2.24-10
Distribution: unstable
Urgency: medium
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Changed-By: Aurelien Jarno <aurel32@debian.org>
Description:
 glibc-doc  - GNU C Library: Documentation
 glibc-source - GNU C Library: sources
 libc-bin   - GNU C Library: Binaries
 libc-dev-bin - GNU C Library: Development binaries
 libc-l10n  - GNU C Library: localization files
 libc0.1    - GNU C Library: Shared libraries
 libc0.1-dbg - GNU C Library: detached debugging symbols
 libc0.1-dev - GNU C Library: Development Libraries and Header Files
 libc0.1-dev-i386 - GNU C Library: 32bit development libraries for AMD64
 libc0.1-i386 - GNU C Library: 32bit shared libraries for AMD64
 libc0.1-i686 - transitional dummy package
 libc0.1-pic - GNU C Library: PIC archive library
 libc0.1-udeb - GNU C Library: Shared libraries - udeb (udeb)
 libc0.3    - GNU C Library: Shared libraries
 libc0.3-dbg - GNU C Library: detached debugging symbols
 libc0.3-dev - GNU C Library: Development Libraries and Header Files
 libc0.3-i686 - transitional dummy package
 libc0.3-pic - GNU C Library: PIC archive library
 libc0.3-udeb - GNU C Library: Shared libraries - udeb (udeb)
 libc0.3-xen - GNU C Library: Shared libraries [Xen version]
 libc6      - GNU C Library: Shared libraries
 libc6-amd64 - GNU C Library: 64bit Shared libraries for AMD64
 libc6-dbg  - GNU C Library: detached debugging symbols
 libc6-dev  - GNU C Library: Development Libraries and Header Files
 libc6-dev-amd64 - GNU C Library: 64bit Development Libraries for AMD64
 libc6-dev-i386 - GNU C Library: 32-bit development libraries for AMD64
 libc6-dev-mips32 - GNU C Library: o32 Development Libraries for MIPS
 libc6-dev-mips64 - GNU C Library: 64bit Development Libraries for MIPS64
 libc6-dev-mipsn32 - GNU C Library: n32 Development Libraries for MIPS64
 libc6-dev-powerpc - GNU C Library: 32bit powerpc development libraries for ppc64
 libc6-dev-ppc64 - GNU C Library: 64bit Development Libraries for PowerPC64
 libc6-dev-s390 - GNU C Library: 32bit Development Libraries for IBM zSeries
 libc6-dev-sparc - GNU C Library: 32bit Development Libraries for SPARC
 libc6-dev-sparc64 - GNU C Library: 64bit Development Libraries for UltraSPARC
 libc6-dev-x32 - GNU C Library: X32 ABI Development Libraries for AMD64
 libc6-i386 - GNU C Library: 32-bit shared libraries for AMD64
 libc6-i686 - transitional dummy package
 libc6-mips32 - GNU C Library: o32 Shared libraries for MIPS
 libc6-mips64 - GNU C Library: 64bit Shared libraries for MIPS64
 libc6-mipsn32 - GNU C Library: n32 Shared libraries for MIPS64
 libc6-pic  - GNU C Library: PIC archive library
 libc6-powerpc - GNU C Library: 32bit powerpc shared libraries for ppc64
 libc6-ppc64 - GNU C Library: 64bit Shared libraries for PowerPC64
 libc6-s390 - GNU C Library: 32bit Shared libraries for IBM zSeries
 libc6-sparc - GNU C Library: 32bit Shared libraries for SPARC
 libc6-sparc64 - GNU C Library: 64bit Shared libraries for UltraSPARC
 libc6-udeb - GNU C Library: Shared libraries - udeb (udeb)
 libc6-x32  - GNU C Library: X32 ABI Shared libraries for AMD64
 libc6-xen  - GNU C Library: Shared libraries [Xen version]
 libc6.1    - GNU C Library: Shared libraries
 libc6.1-alphaev67 - GNU C Library: Shared libraries (EV67 optimized)
 libc6.1-dbg - GNU C Library: detached debugging symbols
 libc6.1-dev - GNU C Library: Development Libraries and Header Files
 libc6.1-pic - GNU C Library: PIC archive library
 libc6.1-udeb - GNU C Library: Shared libraries - udeb (udeb)
 locales    - GNU C Library: National Language (locale) data [support]
 locales-all - GNU C Library: Precompiled locale data
 multiarch-support - Transitional package to ensure multiarch compatibility
 nscd       - GNU C Library: Name Service Cache Daemon
Closes: 857909
Changes:
 glibc (2.24-10) unstable; urgency=medium
 .
   [ Samuel Thibault ]
   * hurd-i386/cvs-truncate64.diff: New patch to support 64bit truncate.
   * hurd-i386/cvs-send-recv-posix.diff: New patch to make send/recv more
     posix.
 .
   [ Aurelien Jarno ]
   * debian/patches/git-updates.diff: update from upstream stable branch:
     - Fix readahead on mips64el.
     - Improve branch predication in _dl_runtime_resolve_avx512_opt;
     - Fix symbol redirect for fts_set on 32-bit architectures.
     - Fix AVX2/AVX512 optimized unaligned memset.
     - Don't use PLT nor GOT in static archives on amd64.
     - Drop GLIBC_TUNABLES in setxid processes.
     - Fix write-after-destroy in lock elision on powerpc/ppc64el.
   * Drop patches/any/cvs-resolv-internal-qtype.diff, merged upstream.
   * any/cvs-remove-pid-tid-cache-clone.diff: patch from upstream to remove
     cached PID/TID in clone.  Closes: #857909.
   * debian/rules.d/build.mk: do not fail the build in case of testsuite
     regressions when building a +debXuX version. That way changes in the
     environment (e.g.: kernel) do not prevent security or stable versions
     to be built.
Checksums-Sha1:
 50ef95bfc22fee8a4d676f8080d368c45af374cb 8355 glibc_2.24-10.dsc
 e92a81cf2bbfbb470c6e2baba64265c64b382f70 987372 glibc_2.24-10.debian.tar.xz
 69cd5dcad8cc31b23c3bb24015212ee46d12c61b 7212 glibc_2.24-10_source.buildinfo
Checksums-Sha256:
 bc3eecc0bc562837941133cd3a71f3055c13d43cd49fd326bd0575fcf6b09625 8355 glibc_2.24-10.dsc
 4b3789ce164d3b7fb7d01cdfb967a84bcbf4369c4570e201dff37432c8e2dd67 987372 glibc_2.24-10.debian.tar.xz
 d73d86373e9dbb7e3a2f7eb4b67ef9a6576db5c0c7a15a2762d955602c8b0153 7212 glibc_2.24-10_source.buildinfo
Files:
 b80caff1e8720ad61f91fc6a8e41323b 8355 libs required glibc_2.24-10.dsc
 3c2c5463073ac38e76c0bb4383abee8e 987372 libs required glibc_2.24-10.debian.tar.xz
 8f68c0a561cd8291416f7834a83456f4 7212 libs required glibc_2.24-10_source.buildinfo

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEd0YmQqnvlP0Pdxltupx4Bh3djJsFAljtVW8ACgkQupx4Bh3d
jJtw2RAAnFke8q2yEGqIp7Qawl4bKy1NztpB+n5FTCrtlu4KOdvarFpnnYh6woIW
YNXU4zU9/zmJeceo6MlwHEkWfcsT/zb9IAdXKRNuCcZY8EfEYRV7Tm8D8gKjT5m+
yHKGqtpep464YvNadYB+XgB6Wo0tImoyAkKyOEGQlmEZIFrSKJSpYBb4+SGrlRa8
bguRcpTtxnZsLO1wPb928Y8LaHlxrLSt1tF9qRG8aVM7SmlgnFiMnRj+K8d5ibB2
SWzXD7Xvd68Dx8doarQsyIzPbdI0AcTLyZ7F/pArorOiy4TZ/JkKhgcBzi2LqKOH
fKmb56DyV+9afCXvji/cI5HwDq4r85QRk47Z/aUfXZBEcAeRJSCrIIw3VQV6VYuR
3TsIY2SL9ovx5WGsezJ3tSzzvcr6O7Kfm4M5usuFkYqOywHyuem0tZxDw7Qwfwd4
xw6EQIvEz3s3MVmmyNYjUd/Zgwf8drt1npiq5Yqe0N5m7qPNNulRtEKXLijruXZM
aIfRAIgjcg3qL5oUoa2zAfeRlo8mKLbUbpAgFvjV5G6UplhWSTM+wvigND3VMqxN
Xa9B2RGN+nMIRuSq1RK4jJd+aQBZrlNBLrrBgHI93uBdMVBN64Z5pCoJH8W5xdDt
4yGIrSJOgkILXwo7k11ckK+qSB2rGMZwRqvvpmg43W5tGmHLA1o=
=OZ2v
-----END PGP SIGNATURE-----

--- End Message ---

Reply to: