提交 977bdfcf 编写于 作者: M Mao Minkai 提交者: guzitao

sw64: fix sys_rt_sigaction

Sunway inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I56XYC

--------------------------------

__ARCH_HAS_SA_RESTORER was defined to fix compile error in the past.
However, this changed the offset of sa_mask in struct sigaction and
made sys_rt_sigaction unable to get sa_mask passed from user.

To fix this problem, the old sigaction and the related structs are
added back, macro define __ARCH_HAS_SA_RESTORER is removed.
Signed-off-by: NMao Minkai <maominkai@wxiat.com>
Signed-off-by: NGu Zitao <guzitao@wxiat.com>
上级 9b7a5aa2
...@@ -23,7 +23,6 @@ config SW64 ...@@ -23,7 +23,6 @@ config SW64
select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_ARCH_TRANSPARENT_HUGEPAGE
select HAVE_ARCH_AUDITSYSCALL select HAVE_ARCH_AUDITSYSCALL
select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_SECCOMP_FILTER
select OLD_SIGACTION
select OLD_SIGSUSPEND select OLD_SIGSUSPEND
select GENERIC_STRNCPY_FROM_USER select GENERIC_STRNCPY_FROM_USER
select GENERIC_STRNLEN_USER select GENERIC_STRNLEN_USER
......
...@@ -14,9 +14,11 @@ typedef struct { ...@@ -14,9 +14,11 @@ typedef struct {
unsigned long sig[_NSIG_WORDS]; unsigned long sig[_NSIG_WORDS];
} sigset_t; } sigset_t;
#ifdef CONFIG_OLD_SIGACTION struct odd_sigaction {
#define __ARCH_HAS_SA_RESTORER __sighandler_t sa_handler;
#endif old_sigset_t sa_mask;
int sa_flags;
};
#include <asm/sigcontext.h> #include <asm/sigcontext.h>
#endif #endif
...@@ -38,6 +38,36 @@ SYSCALL_DEFINE2(odd_sigprocmask, int, how, unsigned long, newmask) ...@@ -38,6 +38,36 @@ SYSCALL_DEFINE2(odd_sigprocmask, int, how, unsigned long, newmask)
return res; return res;
} }
SYSCALL_DEFINE3(odd_sigaction, int, sig,
const struct odd_sigaction __user *, act,
struct odd_sigaction __user *, oact)
{
struct k_sigaction new_ka, old_ka;
old_sigset_t mask;
int ret;
if (act) {
if (!access_ok(act, sizeof(*act)) ||
__get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
__get_user(new_ka.sa.sa_flags, &act->sa_flags) ||
__get_user(mask, &act->sa_mask))
return -EFAULT;
siginitset(&new_ka.sa.sa_mask, mask);
}
ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
if (!ret && oact) {
if (!access_ok(oact, sizeof(*oact)) ||
__put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
__put_user(old_ka.sa.sa_flags, &oact->sa_flags) ||
__put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask))
return -EFAULT;
}
return ret;
}
/* /*
* Do a signal return; undo the signal stack. * Do a signal return; undo the signal stack.
*/ */
......
...@@ -163,7 +163,7 @@ ...@@ -163,7 +163,7 @@
#153 is unused #153 is unused
#154 is unused #154 is unused
#155 is unused #155 is unused
156 common sigaction sys_sigaction 156 common sigaction sys_odd_sigaction
#157 is unused #157 is unused
#158 is unused #158 is unused
#159 is unused #159 is unused
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册