Commit ead8e4e7 authored by Al Viro's avatar Al Viro

x86: __setup_rt_frame(): consolidate uaccess areas

reorder copy_siginfo_to_user() calls a bit
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5c1f1780
...@@ -357,7 +357,6 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, ...@@ -357,7 +357,6 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
{ {
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
void __user *restorer; void __user *restorer;
int err = 0;
void __user *fp = NULL; void __user *fp = NULL;
frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fp); frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fp);
...@@ -393,11 +392,11 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, ...@@ -393,11 +392,11 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
*/ */
unsafe_put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode, Efault); unsafe_put_user(*((u64 *)&rt_retcode), (u64 *)frame->retcode, Efault);
unsafe_put_sigcontext(&frame->uc.uc_mcontext, fp, regs, set, Efault); unsafe_put_sigcontext(&frame->uc.uc_mcontext, fp, regs, set, Efault);
unsafe_put_user(*(__u64 *)set,
(__u64 __user *)&frame->uc.uc_sigmask, Efault);
user_access_end(); user_access_end();
err |= copy_siginfo_to_user(&frame->info, &ksig->info); if (copy_siginfo_to_user(&frame->info, &ksig->info))
err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
if (err)
return -EFAULT; return -EFAULT;
/* Set up registers for signal handler */ /* Set up registers for signal handler */
...@@ -439,23 +438,14 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, ...@@ -439,23 +438,14 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
struct rt_sigframe __user *frame; struct rt_sigframe __user *frame;
void __user *fp = NULL; void __user *fp = NULL;
unsigned long uc_flags; unsigned long uc_flags;
int err = 0;
/* x86-64 should always use SA_RESTORER. */ /* x86-64 should always use SA_RESTORER. */
if (!(ksig->ka.sa.sa_flags & SA_RESTORER)) if (!(ksig->ka.sa.sa_flags & SA_RESTORER))
return -EFAULT; return -EFAULT;
frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp); frame = get_sigframe(&ksig->ka, regs, sizeof(struct rt_sigframe), &fp);
if (!access_ok(frame, sizeof(*frame)))
return -EFAULT;
if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
if (copy_siginfo_to_user(&frame->info, &ksig->info))
return -EFAULT;
}
uc_flags = frame_uc_flags(regs); uc_flags = frame_uc_flags(regs);
if (!user_access_begin(frame, sizeof(*frame))) if (!user_access_begin(frame, sizeof(*frame)))
return -EFAULT; return -EFAULT;
...@@ -468,11 +458,13 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig, ...@@ -468,11 +458,13 @@ static int __setup_rt_frame(int sig, struct ksignal *ksig,
already in userspace. */ already in userspace. */
unsafe_put_user(ksig->ka.sa.sa_restorer, &frame->pretcode, Efault); unsafe_put_user(ksig->ka.sa.sa_restorer, &frame->pretcode, Efault);
unsafe_put_sigcontext(&frame->uc.uc_mcontext, fp, regs, set, Efault); unsafe_put_sigcontext(&frame->uc.uc_mcontext, fp, regs, set, Efault);
unsafe_put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0], Efault);
user_access_end(); user_access_end();
err |= __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
if (err) if (ksig->ka.sa.sa_flags & SA_SIGINFO) {
return -EFAULT; if (copy_siginfo_to_user(&frame->info, &ksig->info))
return -EFAULT;
}
/* Set up registers for signal handler */ /* Set up registers for signal handler */
regs->di = sig; regs->di = sig;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment