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 <lexa@lexa.ru> Sponsored by: The FreeBSD Foundation MFC after: 1 week
This commit is contained in:
parent
966e729842
commit
271ab2406f
@ -653,9 +653,10 @@ kern_sigaction(td, sig, act, oact, flags)
|
|||||||
|
|
||||||
if (!_SIG_VALID(sig))
|
if (!_SIG_VALID(sig))
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
if (act != NULL && (act->sa_flags & ~(SA_ONSTACK | SA_RESTART |
|
if (act != NULL && act->sa_handler != SIG_DFL &&
|
||||||
SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER | SA_NOCLDWAIT |
|
act->sa_handler != SIG_IGN && (act->sa_flags & ~(SA_ONSTACK |
|
||||||
SA_SIGINFO)) != 0)
|
SA_RESTART | SA_RESETHAND | SA_NOCLDSTOP | SA_NODEFER |
|
||||||
|
SA_NOCLDWAIT | SA_SIGINFO)) != 0)
|
||||||
return (EINVAL);
|
return (EINVAL);
|
||||||
|
|
||||||
PROC_LOCK(p);
|
PROC_LOCK(p);
|
||||||
|
Loading…
Reference in New Issue
Block a user