From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32070 invoked by alias); 22 Sep 2008 11:45:24 -0000 Received: (qmail 31419 invoked by uid 48); 22 Sep 2008 11:44:12 -0000 Date: Mon, 22 Sep 2008 11:45:00 -0000 From: "mtk dot manpages at gmail dot com" To: glibc-bugs@sources.redhat.com Message-ID: <20080922114412.6910.mtk.manpages@gmail.com> Reply-To: sourceware-bugzilla@sourceware.org Subject: [Bug libc/6910] New: getpid() wrong in child's signal handler after clone() X-Bugzilla-Reason: CC Mailing-List: contact glibc-bugs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: glibc-bugs-owner@sourceware.org X-SW-Source: 2008-09/txt/msg00052.txt.bz2 As at glibc 2.8, glibc caching of PIDs for getpid() means that if a signal is delivered to the child soon after a clone() (i.e., before the child has a chance to update the cache), then a call to getpid() within the signal handler in the child returns the wrong value. To test this, the attached program creates a child process that continuously sends a SIGQUIT signal to the process group. Meanwhile the parent loops creating children that sleep for a moment, and then terminate. In that time, the SIGQUIT handler will be invoked in the child. If the getpid() cache has not yet been updated, then it will (occasionally) happen that the values returned by glibc's getpid() and a raw syscall(SYS_getpid) will not match. When that occurs, the child prints a message noting the mismatch. If this program is invoked with any command-line argument, then it uses fork() instead of clone(). This can be used to show that the problem does not occur for fork(). -- Summary: getpid() wrong in child's signal handler after clone() Product: glibc Version: 2.8 Status: NEW Severity: normal Priority: P2 Component: libc AssignedTo: drepper at redhat dot com ReportedBy: mtk dot manpages at gmail dot com CC: glibc-bugs at sources dot redhat dot com http://sourceware.org/bugzilla/show_bug.cgi?id=6910 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.