fix: differences in behavior of sigaction between Linux and Mckernel
This commit is contained in:
@ -18,6 +18,11 @@
|
||||
#define _NSIG_BPW 64
|
||||
#define _NSIG_WORDS (_NSIG / _NSIG_BPW)
|
||||
|
||||
static inline int valid_signal(unsigned long sig)
|
||||
{
|
||||
return sig <= _NSIG ? 1 : 0;
|
||||
}
|
||||
|
||||
typedef unsigned long int __sigset_t;
|
||||
#define __sigmask(sig) (((__sigset_t) 1) << ((sig) - 1))
|
||||
|
||||
|
||||
@ -143,8 +143,6 @@ SYSCALL_DECLARE(rt_sigaction)
|
||||
struct k_sigaction new_sa, old_sa;
|
||||
int rc;
|
||||
|
||||
if(sig == SIGKILL || sig == SIGSTOP || sig <= 0 || sig > 64)
|
||||
return -EINVAL;
|
||||
if (sigsetsize != sizeof(sigset_t))
|
||||
return -EINVAL;
|
||||
|
||||
|
||||
@ -3059,6 +3059,13 @@ do_sigaction(int sig, struct k_sigaction *act, struct k_sigaction *oact)
|
||||
struct mcs_rwlock_node_irqsave mcs_rw_node;
|
||||
ihk_mc_user_context_t ctx0;
|
||||
|
||||
if (!valid_signal(sig) || sig < 1) {
|
||||
return -EINVAL;
|
||||
}
|
||||
if (act && (sig == SIGKILL || sig == SIGSTOP)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
mcs_rwlock_writer_lock(&thread->sigcommon->lock, &mcs_rw_node);
|
||||
k = thread->sigcommon->action + sig - 1;
|
||||
if(oact)
|
||||
|
||||
Reference in New Issue
Block a user