Author: kib
Date: Fri Jan 16 07:06:58 2015
New Revision: 277236
URL: https://svnweb.freebsd.org/changeset/base/277236

Log:
  For sigaction(2), ignore possible garbage in sa_flags for sa_handler
  == SIG_DFL or SIG_IGN.  Sloppy code does not fully initialize struct
  sigaction for such cases, and being too demanding in the case of
  default handler does not catch anything.
  
  Reported and tested by:       Alex Tutubalin <l...@lexa.ru>
  Sponsored by: The FreeBSD Foundation
  MFC after:    1 week

Modified:
  head/sys/kern/kern_sig.c

Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c    Fri Jan 16 06:19:52 2015        (r277235)
+++ head/sys/kern/kern_sig.c    Fri Jan 16 07:06:58 2015        (r277236)
@@ -653,9 +653,10 @@ kern_sigaction(td, sig, act, oact, flags
 
        if (!_SIG_VALID(sig))
                return (EINVAL);
-       if (act != NULL && (act->sa_flags & ~(SA_ONSTACK | SA_RESTART |
-           SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT |
-           SA_SIGINFO)) != 0)
+       if (act != NULL && act->sa_handler != SIG_DFL &&
+           act->sa_handler != SIG_IGN && (act->sa_flags & ~(SA_ONSTACK |
+           SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER |
+           SA_NOCLDWAIT | SA_SIGINFO)) != 0)
                return (EINVAL);
 
        PROC_LOCK(p);
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to