diff options
author | bde <bde@FreeBSD.org> | 1996-11-29 18:01:55 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-11-29 18:01:55 +0000 |
commit | 0d3f6a937369d19bf8c126ec490e9642e96cc689 (patch) | |
tree | 9af099b5ce0a0b1f622cb204c4cc9a656dcbc4fb /sys/kern | |
parent | 623ea9097a9c438fd452300b19a68333a101c981 (diff) | |
download | FreeBSD-src-0d3f6a937369d19bf8c126ec490e9642e96cc689.zip FreeBSD-src-0d3f6a937369d19bf8c126ec490e9642e96cc689.tar.gz |
Fixed sigaction() for SIGKILL and SIGSTOP. Reading the old action now
succeeds. Writing an action now succeeds iff the handler isn't changed.
(POSIX allows attempts to change the handler to be ignored or cause an
error. Changing other parts of the action is allowed (except attempts
to mask unmaskable signals are silently ignored as usual).)
Found by: NIST-PCTS
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_sig.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 4c6cfe4..1b4bb58 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)kern_sig.c 8.7 (Berkeley) 4/18/94 - * $Id: kern_sig.c,v 1.25 1996/07/09 18:12:37 ache Exp $ + * $Id: kern_sig.c,v 1.26 1996/10/19 01:06:20 davidg Exp $ */ #include "opt_ktrace.h" @@ -108,8 +108,7 @@ sigaction(p, uap, retval) int bit, error; signum = uap->signum; - if (signum <= 0 || signum >= NSIG || - signum == SIGKILL || signum == SIGSTOP) + if (signum <= 0 || signum >= NSIG) return (EINVAL); sa = &vec; if (uap->osa) { @@ -135,6 +134,9 @@ sigaction(p, uap, retval) if ((error = copyin((caddr_t)uap->nsa, (caddr_t)sa, sizeof (vec)))) return (error); + if ((signum == SIGKILL || signum == SIGSTOP) && + sa->sa_handler != SIG_DFL) + return (EINVAL); setsigvec(p, signum, sa); } return (0); @@ -343,8 +345,7 @@ osigvec(p, uap, retval) int bit, error; signum = uap->signum; - if (signum <= 0 || signum >= NSIG || - signum == SIGKILL || signum == SIGSTOP) + if (signum <= 0 || signum >= NSIG) return (EINVAL); sv = &vec; if (uap->osv) { @@ -372,6 +373,9 @@ osigvec(p, uap, retval) if ((error = copyin((caddr_t)uap->nsv, (caddr_t)sv, sizeof (vec)))) return (error); + if ((signum == SIGKILL || signum == SIGSTOP) && + sv->sv_handler != SIG_DFL) + return (EINVAL); #ifdef COMPAT_SUNOS sv->sv_flags |= SA_USERTRAMP; #endif |