Subject: standards/3398: sigaction(2) prohibits read-access to SIG{KILL,STOP} handlers
To: None <gnats-bugs@gnats.netbsd.org>
From: Klaus Klein <kleink@layla.inka.de>
List: netbsd-bugs
Date: 03/26/1997 15:58:53
>Number:         3398
>Category:       standards
>Synopsis:       sigaction(2) prohibits read-access to SIG{KILL,STOP} handlers
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 26 10:05:04 1997
>Last-Modified:
>Originator:     Klaus Klein
>Organization:
private site
>Release:        970325
>Environment:
[mi]

>Description:
IEEE Std 1003.1-1988 section 3.3.4 (sigaction(2)) states that attempts
to block or change a process' SIG{KILL,STOP} handlers shall fail with
EINVAL but implicitly permits their examination; the latter is prohibited
by our sigaction(2) implementation. IEEE Std 2003.1-1992 explicitly
specifies a test for read-access.

Also, some changes to the manpage (addition to SIGKILL description taken
from SIGSTOP, conformance, .Xr to ourselves).

>How-To-Repeat:

>Fix:

Index: lib/libc/sys/sigaction.2
===================================================================
RCS file: /cvsroot/netbsd/src/lib/libc/sys/sigaction.2,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.2.2
diff -b -c -r1.1.1.2 -r1.1.1.2.2.2
*** sigaction.2	1997/01/17 17:18:53	1.1.1.2
--- sigaction.2	1997/03/26 14:44:06	1.1.1.2.2.2
***************
*** 242,248 ****
  .Dv SIGIOT )
  .It Dv SIGEMT No "	create core image" "	emulate instruction executed"
  .It Dv SIGFPE No "	create core image" "	floating-point exception"
! .It Dv SIGKILL No "	terminate process" "	kill program"
  .It Dv SIGBUS No "	create core image" "	bus error"
  .It Dv SIGSEGV No "	create core image" "	segmentation violation"
  .It Dv SIGSYS No "	create core image" "	system call given invalid argument"
--- 242,248 ----
  .Dv SIGIOT )
  .It Dv SIGEMT No "	create core image" "	emulate instruction executed"
  .It Dv SIGFPE No "	create core image" "	floating-point exception"
! .It Dv SIGKILL No "	terminate process" "	kill program (cannot be caught or ignored)"
  .It Dv SIGBUS No "	create core image" "	bus error"
  .It Dv SIGSEGV No "	create core image" "	segmentation violation"
  .It Dv SIGSYS No "	create core image" "	system call given invalid argument"
***************
*** 330,337 ****
  .El
  .Sh STANDARDS
  The
! .Nm sigaction
! function is defined by
  .St -p1003.1-88 .
  The
  .Dv SA_ONSTACK
--- 330,337 ----
  .El
  .Sh STANDARDS
  The
! .Fn sigaction
! function conforms to
  .St -p1003.1-88 .
  The
  .Dv SA_ONSTACK
***************
*** 362,368 ****
  .Xr sigprocmask 2 ,
  .Xr sigsuspend 2 ,
  .Xr sigaltstack 2 ,
- .Xr sigaction 2 ,
  .Xr setjmp 3 ,
  .Xr siginterrupt 3 ,
  .Xr sigsetops 3 ,
--- 362,367 ----
Index: sys/kern/kern_sig.c
===================================================================
RCS file: /cvsroot/netbsd/src/sys/kern/kern_sig.c,v
retrieving revision 1.1.1.2
retrieving revision 1.1.1.2.2.3
diff -b -c -r1.1.1.2 -r1.1.1.2.2.3
*** kern_sig.c	1996/12/29 23:33:27	1.1.1.2
--- kern_sig.c	1997/03/26 14:36:31	1.1.1.2.2.3
***************
*** 104,110 ****
  
  	signum = SCARG(uap, signum);
  	if (signum <= 0 || signum >= NSIG ||
! 	    signum == SIGKILL || signum == SIGSTOP)
  		return (EINVAL);
  	sa = &vec;
  	if (SCARG(uap, osa)) {
--- 104,110 ----
  
  	signum = SCARG(uap, signum);
  	if (signum <= 0 || signum >= NSIG ||
! 	    ((signum == SIGKILL || signum == SIGSTOP) && SCARG(uap, nsa)))
  		return (EINVAL);
  	sa = &vec;
  	if (SCARG(uap, osa)) {
>Audit-Trail:
>Unformatted: