提交 235b8022 编写于 作者: A Al Viro

x86: convert to ksignal

Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
上级 08f73957
...@@ -309,7 +309,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc, ...@@ -309,7 +309,7 @@ static int ia32_setup_sigcontext(struct sigcontext_ia32 __user *sc,
/* /*
* Determine which stack to use.. * Determine which stack to use..
*/ */
static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, static void __user *get_sigframe(struct ksignal *ksig, struct pt_regs *regs,
size_t frame_size, size_t frame_size,
void __user **fpstate) void __user **fpstate)
{ {
...@@ -319,16 +319,13 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, ...@@ -319,16 +319,13 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
sp = regs->sp; sp = regs->sp;
/* This is the X/Open sanctioned signal stack switching. */ /* This is the X/Open sanctioned signal stack switching. */
if (ka->sa.sa_flags & SA_ONSTACK) { if (ksig->ka.sa.sa_flags & SA_ONSTACK)
if (sas_ss_flags(sp) == 0) sp = sigsp(sp, ksig);
sp = current->sas_ss_sp + current->sas_ss_size;
}
/* This is the legacy signal stack switching. */ /* This is the legacy signal stack switching. */
else if ((regs->ss & 0xffff) != __USER32_DS && else if ((regs->ss & 0xffff) != __USER32_DS &&
!(ka->sa.sa_flags & SA_RESTORER) && !(ksig->ka.sa.sa_flags & SA_RESTORER) &&
ka->sa.sa_restorer) ksig->ka.sa.sa_restorer)
sp = (unsigned long) ka->sa.sa_restorer; sp = (unsigned long) ksig->ka.sa.sa_restorer;
if (used_math()) { if (used_math()) {
unsigned long fx_aligned, math_size; unsigned long fx_aligned, math_size;
...@@ -347,7 +344,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, ...@@ -347,7 +344,7 @@ static void __user *get_sigframe(struct k_sigaction *ka, struct pt_regs *regs,
return (void __user *) sp; return (void __user *) sp;
} }
int ia32_setup_frame(int sig, struct k_sigaction *ka, int ia32_setup_frame(int sig, struct ksignal *ksig,
compat_sigset_t *set, struct pt_regs *regs) compat_sigset_t *set, struct pt_regs *regs)
{ {
struct sigframe_ia32 __user *frame; struct sigframe_ia32 __user *frame;
...@@ -366,7 +363,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, ...@@ -366,7 +363,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
0x80cd, /* int $0x80 */ 0x80cd, /* int $0x80 */
}; };
frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
...@@ -383,8 +380,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, ...@@ -383,8 +380,8 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
return -EFAULT; return -EFAULT;
} }
if (ka->sa.sa_flags & SA_RESTORER) { if (ksig->ka.sa.sa_flags & SA_RESTORER) {
restorer = ka->sa.sa_restorer; restorer = ksig->ka.sa.sa_restorer;
} else { } else {
/* Return stub is in 32bit vsyscall page */ /* Return stub is in 32bit vsyscall page */
if (current->mm->context.vdso) if (current->mm->context.vdso)
...@@ -409,7 +406,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, ...@@ -409,7 +406,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->sp = (unsigned long) frame; regs->sp = (unsigned long) frame;
regs->ip = (unsigned long) ka->sa.sa_handler; regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
/* Make -mregparm=3 work */ /* Make -mregparm=3 work */
regs->ax = sig; regs->ax = sig;
...@@ -425,7 +422,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka, ...@@ -425,7 +422,7 @@ int ia32_setup_frame(int sig, struct k_sigaction *ka,
return 0; return 0;
} }
int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
compat_sigset_t *set, struct pt_regs *regs) compat_sigset_t *set, struct pt_regs *regs)
{ {
struct rt_sigframe_ia32 __user *frame; struct rt_sigframe_ia32 __user *frame;
...@@ -446,7 +443,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -446,7 +443,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
0, 0,
}; };
frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); frame = get_sigframe(ksig, regs, sizeof(*frame), &fpstate);
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
...@@ -464,8 +461,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -464,8 +461,8 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
put_user_ex(0, &frame->uc.uc_link); put_user_ex(0, &frame->uc.uc_link);
err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp);
if (ka->sa.sa_flags & SA_RESTORER) if (ksig->ka.sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ksig->ka.sa.sa_restorer;
else else
restorer = VDSO32_SYMBOL(current->mm->context.vdso, restorer = VDSO32_SYMBOL(current->mm->context.vdso,
rt_sigreturn); rt_sigreturn);
...@@ -478,7 +475,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -478,7 +475,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode); put_user_ex(*((u64 *)&code), (u64 __user *)frame->retcode);
} put_user_catch(err); } put_user_catch(err);
err |= copy_siginfo_to_user32(&frame->info, info); err |= copy_siginfo_to_user32(&frame->info, &ksig->info);
err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate, err |= ia32_setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
regs, set->sig[0]); regs, set->sig[0]);
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
...@@ -488,7 +485,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -488,7 +485,7 @@ int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->sp = (unsigned long) frame; regs->sp = (unsigned long) frame;
regs->ip = (unsigned long) ka->sa.sa_handler; regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
/* Make -mregparm=3 work */ /* Make -mregparm=3 work */
regs->ax = sig; regs->ax = sig;
......
...@@ -26,9 +26,10 @@ ...@@ -26,9 +26,10 @@
#ifdef CONFIG_X86_64 #ifdef CONFIG_X86_64
# include <asm/sigcontext32.h> # include <asm/sigcontext32.h>
# include <asm/user32.h> # include <asm/user32.h>
int ia32_setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, struct ksignal;
int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
compat_sigset_t *set, struct pt_regs *regs); compat_sigset_t *set, struct pt_regs *regs);
int ia32_setup_frame(int sig, struct k_sigaction *ka, int ia32_setup_frame(int sig, struct ksignal *ksig,
compat_sigset_t *set, struct pt_regs *regs); compat_sigset_t *set, struct pt_regs *regs);
#else #else
# define user_i387_ia32_struct user_i387_struct # define user_i387_ia32_struct user_i387_struct
......
...@@ -278,7 +278,7 @@ static const struct { ...@@ -278,7 +278,7 @@ static const struct {
}; };
static int static int
__setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
struct pt_regs *regs) struct pt_regs *regs)
{ {
struct sigframe __user *frame; struct sigframe __user *frame;
...@@ -286,7 +286,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, ...@@ -286,7 +286,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
int err = 0; int err = 0;
void __user *fpstate = NULL; void __user *fpstate = NULL;
frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fpstate);
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
...@@ -307,8 +307,8 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, ...@@ -307,8 +307,8 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn); restorer = VDSO32_SYMBOL(current->mm->context.vdso, sigreturn);
else else
restorer = &frame->retcode; restorer = &frame->retcode;
if (ka->sa.sa_flags & SA_RESTORER) if (ksig->ka.sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ksig->ka.sa.sa_restorer;
/* Set up to return from userspace. */ /* Set up to return from userspace. */
err |= __put_user(restorer, &frame->pretcode); err |= __put_user(restorer, &frame->pretcode);
...@@ -327,7 +327,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, ...@@ -327,7 +327,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->sp = (unsigned long)frame; regs->sp = (unsigned long)frame;
regs->ip = (unsigned long)ka->sa.sa_handler; regs->ip = (unsigned long)ksig->ka.sa.sa_handler;
regs->ax = (unsigned long)sig; regs->ax = (unsigned long)sig;
regs->dx = 0; regs->dx = 0;
regs->cx = 0; regs->cx = 0;
...@@ -340,7 +340,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set, ...@@ -340,7 +340,7 @@ __setup_frame(int sig, struct k_sigaction *ka, sigset_t *set,
return 0; return 0;
} }
static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, static int __setup_rt_frame(int sig, struct ksignal *ksig,
sigset_t *set, struct pt_regs *regs) sigset_t *set, struct pt_regs *regs)
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
...@@ -348,7 +348,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -348,7 +348,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
int err = 0; int err = 0;
void __user *fpstate = NULL; void __user *fpstate = NULL;
frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fpstate);
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
...@@ -368,8 +368,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -368,8 +368,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* Set up to return from userspace. */ /* Set up to return from userspace. */
restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn); restorer = VDSO32_SYMBOL(current->mm->context.vdso, rt_sigreturn);
if (ka->sa.sa_flags & SA_RESTORER) if (ksig->ka.sa.sa_flags & SA_RESTORER)
restorer = ka->sa.sa_restorer; restorer = ksig->ka.sa.sa_restorer;
put_user_ex(restorer, &frame->pretcode); put_user_ex(restorer, &frame->pretcode);
/* /*
...@@ -382,7 +382,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -382,7 +382,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode); put_user_ex(*((u64 *)&rt_retcode), (u64 *)frame->retcode);
} put_user_catch(err); } put_user_catch(err);
err |= copy_siginfo_to_user(&frame->info, info); err |= copy_siginfo_to_user(&frame->info, &ksig->info);
err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate, err |= setup_sigcontext(&frame->uc.uc_mcontext, fpstate,
regs, set->sig[0]); regs, set->sig[0]);
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set)); err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
...@@ -392,7 +392,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -392,7 +392,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->sp = (unsigned long)frame; regs->sp = (unsigned long)frame;
regs->ip = (unsigned long)ka->sa.sa_handler; regs->ip = (unsigned long)ksig->ka.sa.sa_handler;
regs->ax = (unsigned long)sig; regs->ax = (unsigned long)sig;
regs->dx = (unsigned long)&frame->info; regs->dx = (unsigned long)&frame->info;
regs->cx = (unsigned long)&frame->uc; regs->cx = (unsigned long)&frame->uc;
...@@ -405,20 +405,20 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -405,20 +405,20 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
return 0; return 0;
} }
#else /* !CONFIG_X86_32 */ #else /* !CONFIG_X86_32 */
static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, static int __setup_rt_frame(int sig, struct ksignal *ksig,
sigset_t *set, struct pt_regs *regs) sigset_t *set, struct pt_regs *regs)
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
void __user *fp = NULL; void __user *fp = NULL;
int err = 0; int err = 0;
frame = get_sigframe(ka, regs, sizeof(struct rt_sigframe), &fp); frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp);
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
if (ka->sa.sa_flags & SA_SIGINFO) { if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
if (copy_siginfo_to_user(&frame->info, info)) if (copy_siginfo_to_user(&frame->info, &ksig->info))
return -EFAULT; return -EFAULT;
} }
...@@ -434,8 +434,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -434,8 +434,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
/* Set up to return from userspace. If provided, use a stub /* Set up to return from userspace. If provided, use a stub
already in userspace. */ already in userspace. */
/* x86-64 should always use SA_RESTORER. */ /* x86-64 should always use SA_RESTORER. */
if (ka->sa.sa_flags & SA_RESTORER) { if (ksig->ka.sa.sa_flags & SA_RESTORER) {
put_user_ex(ka->sa.sa_restorer, &frame->pretcode); put_user_ex(ksig->ka.sa.sa_restorer, &frame->pretcode);
} else { } else {
/* could use a vstub here */ /* could use a vstub here */
err |= -EFAULT; err |= -EFAULT;
...@@ -457,7 +457,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -457,7 +457,7 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
next argument after the signal number on the stack. */ next argument after the signal number on the stack. */
regs->si = (unsigned long)&frame->info; regs->si = (unsigned long)&frame->info;
regs->dx = (unsigned long)&frame->uc; regs->dx = (unsigned long)&frame->uc;
regs->ip = (unsigned long) ka->sa.sa_handler; regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
regs->sp = (unsigned long)frame; regs->sp = (unsigned long)frame;
...@@ -469,8 +469,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, ...@@ -469,8 +469,8 @@ static int __setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info,
} }
#endif /* CONFIG_X86_32 */ #endif /* CONFIG_X86_32 */
static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, static int x32_setup_rt_frame(struct ksignal *ksig,
siginfo_t *info, compat_sigset_t *set, compat_sigset_t *set,
struct pt_regs *regs) struct pt_regs *regs)
{ {
#ifdef CONFIG_X86_X32_ABI #ifdef CONFIG_X86_X32_ABI
...@@ -479,13 +479,13 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, ...@@ -479,13 +479,13 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
int err = 0; int err = 0;
void __user *fpstate = NULL; void __user *fpstate = NULL;
frame = get_sigframe(ka, regs, sizeof(*frame), &fpstate); frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fpstate);
if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame))) if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
if (ka->sa.sa_flags & SA_SIGINFO) { if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
if (copy_siginfo_to_user32(&frame->info, info)) if (copy_siginfo_to_user32(&frame->info, &ksig->info))
return -EFAULT; return -EFAULT;
} }
...@@ -499,8 +499,8 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, ...@@ -499,8 +499,8 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp); err |= __compat_save_altstack(&frame->uc.uc_stack, regs->sp);
put_user_ex(0, &frame->uc.uc__pad0); put_user_ex(0, &frame->uc.uc__pad0);
if (ka->sa.sa_flags & SA_RESTORER) { if (ksig->ka.sa.sa_flags & SA_RESTORER) {
restorer = ka->sa.sa_restorer; restorer = ksig->ka.sa.sa_restorer;
} else { } else {
/* could use a vstub here */ /* could use a vstub here */
restorer = NULL; restorer = NULL;
...@@ -518,10 +518,10 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka, ...@@ -518,10 +518,10 @@ static int x32_setup_rt_frame(int sig, struct k_sigaction *ka,
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->sp = (unsigned long) frame; regs->sp = (unsigned long) frame;
regs->ip = (unsigned long) ka->sa.sa_handler; regs->ip = (unsigned long) ksig->ka.sa.sa_handler;
/* We use the x32 calling convention here... */ /* We use the x32 calling convention here... */
regs->di = sig; regs->di = ksig->sig;
regs->si = (unsigned long) &frame->info; regs->si = (unsigned long) &frame->info;
regs->dx = (unsigned long) &frame->uc; regs->dx = (unsigned long) &frame->uc;
...@@ -611,30 +611,29 @@ static int signr_convert(int sig) ...@@ -611,30 +611,29 @@ static int signr_convert(int sig)
} }
static int static int
setup_rt_frame(int sig, struct k_sigaction *ka, siginfo_t *info, setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs)
struct pt_regs *regs)
{ {
int usig = signr_convert(sig); int usig = signr_convert(ksig->sig);
sigset_t *set = sigmask_to_save(); sigset_t *set = sigmask_to_save();
compat_sigset_t *cset = (compat_sigset_t *) set; compat_sigset_t *cset = (compat_sigset_t *) set;
/* Set up the stack frame */ /* Set up the stack frame */
if (is_ia32_frame()) { if (is_ia32_frame()) {
if (ka->sa.sa_flags & SA_SIGINFO) if (ksig->ka.sa.sa_flags & SA_SIGINFO)
return ia32_setup_rt_frame(usig, ka, info, cset, regs); return ia32_setup_rt_frame(usig, ksig, cset, regs);
else else
return ia32_setup_frame(usig, ka, cset, regs); return ia32_setup_frame(usig, ksig, cset, regs);
} else if (is_x32_frame()) { } else if (is_x32_frame()) {
return x32_setup_rt_frame(usig, ka, info, cset, regs); return x32_setup_rt_frame(ksig, cset, regs);
} else { } else {
return __setup_rt_frame(sig, ka, info, set, regs); return __setup_rt_frame(ksig->sig, ksig, set, regs);
} }
} }
static void static void
handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, handle_signal(struct ksignal *ksig, struct pt_regs *regs)
struct pt_regs *regs)
{ {
bool failed;
/* Are we from a system call? */ /* Are we from a system call? */
if (syscall_get_nr(current, regs) >= 0) { if (syscall_get_nr(current, regs) >= 0) {
/* If so, check system call restarting.. */ /* If so, check system call restarting.. */
...@@ -645,7 +644,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -645,7 +644,7 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
break; break;
case -ERESTARTSYS: case -ERESTARTSYS:
if (!(ka->sa.sa_flags & SA_RESTART)) { if (!(ksig->ka.sa.sa_flags & SA_RESTART)) {
regs->ax = -EINTR; regs->ax = -EINTR;
break; break;
} }
...@@ -665,16 +664,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -665,16 +664,12 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
likely(test_and_clear_thread_flag(TIF_FORCED_TF))) likely(test_and_clear_thread_flag(TIF_FORCED_TF)))
regs->flags &= ~X86_EFLAGS_TF; regs->flags &= ~X86_EFLAGS_TF;
if (setup_rt_frame(sig, ka, info, regs) < 0) { failed = (setup_rt_frame(ksig, regs) < 0);
force_sigsegv(sig, current); if (!failed) {
return;
}
/* /*
* Clear the direction flag as per the ABI for function entry. * Clear the direction flag as per the ABI for function entry.
*/ */
regs->flags &= ~X86_EFLAGS_DF; regs->flags &= ~X86_EFLAGS_DF;
/* /*
* Clear TF when entering the signal handler, but * Clear TF when entering the signal handler, but
* notify any tracer that was single-stepping it. * notify any tracer that was single-stepping it.
...@@ -682,9 +677,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -682,9 +677,8 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
* handler too. * handler too.
*/ */
regs->flags &= ~X86_EFLAGS_TF; regs->flags &= ~X86_EFLAGS_TF;
}
signal_delivered(sig, info, ka, regs, signal_setup_done(failed, ksig, test_thread_flag(TIF_SINGLESTEP));
test_thread_flag(TIF_SINGLESTEP));
} }
#ifdef CONFIG_X86_32 #ifdef CONFIG_X86_32
...@@ -701,14 +695,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka, ...@@ -701,14 +695,11 @@ handle_signal(unsigned long sig, siginfo_t *info, struct k_sigaction *ka,
*/ */
static void do_signal(struct pt_regs *regs) static void do_signal(struct pt_regs *regs)
{ {
struct k_sigaction ka; struct ksignal ksig;
siginfo_t info;
int signr;
signr = get_signal_to_deliver(&info, &ka, regs, NULL); if (get_signal(&ksig)) {
if (signr > 0) {
/* Whee! Actually deliver the signal. */ /* Whee! Actually deliver the signal. */
handle_signal(signr, &info, &ka, regs); handle_signal(&ksig, regs);
return; return;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册