kern/80130: [patch] sigprocmask erronously cleared on fork(5-STABLE and later)

David Xu davidxu at freebsd.org
Wed Apr 20 01:40:16 PDT 2005


The following reply was made to PR kern/80130; it has been noted by GNATS.

From: David Xu <davidxu at freebsd.org>
To: Kostik Belousov <konstantin.belousov at zoral.com.ua>
Cc: freebsd-gnats-submit at 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 at 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
 


More information about the freebsd-bugs mailing list