diff options
-rw-r--r-- | sys/compat/linux/linux_signal.c | 4 | ||||
-rw-r--r-- | sys/compat/linux/linux_signal.h | 2 | ||||
-rw-r--r-- | sys/i386/linux/linux_machdep.c | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/sys/compat/linux/linux_signal.c b/sys/compat/linux/linux_signal.c index 852c501..4a4ec12 100644 --- a/sys/compat/linux/linux_signal.c +++ b/sys/compat/linux/linux_signal.c @@ -144,7 +144,7 @@ linux_do_sigaction(struct thread *td, int linux_sig, l_sigaction_t *linux_nsa, struct sigaction act, oact, *nsa, *osa; int error, sig; - if (linux_sig <= 0 || linux_sig > LINUX_NSIG) + if (!LINUX_SIG_VALID(linux_sig)) return (EINVAL); osa = (linux_osa != NULL) ? &oact : NULL; @@ -438,7 +438,7 @@ linux_kill(struct thread *td, struct linux_kill_args *args) /* * Allow signal 0 as a means to check for privileges */ - if (args->signum < 0 || args->signum > LINUX_NSIG) + if (!LINUX_SIG_VALID(linux_sig) && args->signum != 0) return EINVAL; if (args->signum > 0 && args->signum <= LINUX_SIGTBLSZ) diff --git a/sys/compat/linux/linux_signal.h b/sys/compat/linux/linux_signal.h index edb7c66..5f6d5bd 100644 --- a/sys/compat/linux/linux_signal.h +++ b/sys/compat/linux/linux_signal.h @@ -35,4 +35,6 @@ void linux_to_bsd_sigset(l_sigset_t *, sigset_t *); void bsd_to_linux_sigset(sigset_t *, l_sigset_t *); int linux_do_sigaction(struct thread *, int, l_sigaction_t *, l_sigaction_t *); +#define LINUX_SIG_VALID(sig) ((sig) <= LINUX_NSIG && (sig) > 0) + #endif /* _LINUX_SIGNAL_H_ */ diff --git a/sys/i386/linux/linux_machdep.c b/sys/i386/linux/linux_machdep.c index f52386d..d888744 100644 --- a/sys/i386/linux/linux_machdep.c +++ b/sys/i386/linux/linux_machdep.c @@ -365,7 +365,7 @@ linux_clone(struct thread *td, struct linux_clone_args *args) #endif exit_signal = args->flags & 0x000000ff; - if (exit_signal >= LINUX_NSIG) + if (!LINUX_SIG_VALID(exit_signal)) return (EINVAL); if (exit_signal <= LINUX_SIGTBLSZ) |