From owner-freebsd-bugs@FreeBSD.ORG Wed Apr 20 08:40:16 2005 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1EA6516A4CE for ; Wed, 20 Apr 2005 08:40:16 +0000 (GMT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id C470B43D31 for ; Wed, 20 Apr 2005 08:40:15 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.3/8.13.3) with ESMTP id j3K8eFtK041427 for ; Wed, 20 Apr 2005 08:40:15 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.3/8.13.1/Submit) id j3K8eF6O041426; Wed, 20 Apr 2005 08:40:15 GMT (envelope-from gnats) Date: Wed, 20 Apr 2005 08:40:15 GMT Message-Id: <200504200840.j3K8eF6O041426@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: David Xu Subject: Re: kern/80130: [patch] sigprocmask erronously cleared on fork(5-STABLE and later) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: David Xu List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Apr 2005 08:40:16 -0000 The following reply was made to PR kern/80130; it has been noted by GNATS. From: David Xu To: Kostik Belousov Cc: freebsd-gnats-submit@freebsd.org Subject: Re: kern/80130: [patch] sigprocmask erronously cleared on fork (5-STABLE and later) Date: Wed, 20 Apr 2005 16:32:58 +0800 Kostik Belousov wrote: >>Number: 80130 >>Category: kern >>Synopsis: [patch] sigprocmask erronously cleared on fork (5-STABLE and later) >>Confidential: no >>Severity: serious >>Priority: medium >>Responsible: freebsd-bugs >>State: open >>Quarter: >>Keywords: >>Date-Required: >>Class: sw-bug >>Submitter-Id: current-users >>Arrival-Date: Wed Apr 20 07:40:02 GMT 2005 >>Closed-Date: >>Last-Modified: >>Originator: Kostik Belousov >>Release: 5-STABLE >>Organization: >>Environment: >> >> >FreeBSD deviant.zoral.local 5.4-STABLE FreeBSD 5.4-STABLE #16: Tue Apr 12 11:06:01 EEST 2005 root@deviant.zoral.local:/usr/obj/usr/src/sys/DEVIANT i386 > > >>Description: >> >> > After fork(), the 5-STABLE system sets the child process >blocked signal mask to 0 (let us account single-threaded processes only). I was under impression that signal mask shall be inherited by the child process (according to SUSv3 and man fork). Inheritance _was_ the behaviour of 4-STABLE (there, p_sigmask belongs to struct proc and placed in the copied-on-fork part of the structure) and also seen on other UNIXes (e.g. Solaris). > >It seems that needs of thread_schedule_upcall() to zero sigmask interfere with the needs of the fork1(). I propose the trivial patch (against 5-STABLE) to fix the problems. It handles td_sigmask in the way similar to td_sigstk, that is also zeroed on _upcall(), as was done by davidxu at kern/kern_fork.c:1.209 rev. > > >>How-To-Repeat: >> >> >I send the letter to the freebsd-hackers at Apr 12, 2005 with the program that shows the problem, see > >http://lists.freebsd.org/pipermail/freebsd-hackers/2005-April/011513.html > > > > >>Fix: >> >> >Index: kern/kern_fork.c >=================================================================== >RCS file: /usr/local/arch/ncvs/src/sys/kern/kern_fork.c,v >retrieving revision 1.234.2.8 >diff -U3 -r1.234.2.8 kern_fork.c >--- kern/kern_fork.c 27 Feb 2005 02:36:39 -0000 1.234.2.8 >+++ kern/kern_fork.c 20 Apr 2005 07:27:00 -0000 >@@ -472,6 +472,7 @@ > __rangeof(struct ksegrp, kg_startcopy, kg_endcopy)); > > td2->td_sigstk = td->td_sigstk; >+ td2->td_sigmask = td->td_sigmask; > > /* > * Duplicate sub-structures as needed. > > > >>Release-Note: >>Audit-Trail: >>Unformatted: >> >> The bug is also in -CURRENT. :( David Xu