x86: ia32_setup_rt_frame(): consolidate uaccess areas

commit 57d563c829 upstream.

__copy_siginfo_to_user32() call reordered a bit.  The rest folds
nicely.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Chen Zhuo <sagazchen@tencent.com>
Signed-off-by: Xinghui Li <korantli@tencent.com>
This commit is contained in:
Al Viro 2020-02-15 19:42:40 -05:00 committed by Jianping Liu
parent 8c2e0bd541
commit 2779664eca
1 changed files with 3 additions and 10 deletions

View File

@ -306,10 +306,9 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
{
struct rt_sigframe_ia32 __user *frame;
void __user *restorer;
int err = 0;
void __user *fp = NULL;
/* __copy_to_user optimizes that into a single 8 byte store */
/* unsafe_put_user optimizes that into a single 8 byte store */
static const struct {
u8 movl;
u32 val;
@ -351,18 +350,12 @@ int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
* versions need it.
*/
unsafe_put_user(*((u64 *)&code), (u64 __user *)frame->retcode, Efault);
unsafe_put_sigcontext32(&frame->uc.uc_mcontext, fp, regs, set, Efault);
unsafe_put_user(*(__u64 *)set, (__u64 *)&frame->uc.uc_sigmask, Efault);
user_access_end();
if (__copy_siginfo_to_user32(&frame->info, &ksig->info, false))
return -EFAULT;
if (!user_access_begin(&frame->uc.uc_mcontext, sizeof(struct sigcontext_32)))
return -EFAULT;
unsafe_put_sigcontext32(&frame->uc.uc_mcontext, fp, regs, set, Efault);
user_access_end();
err |= __put_user(*(__u64 *)set, (__u64 __user *)&frame->uc.uc_sigmask);
if (err)
return -EFAULT;
/* Set up registers for signal handler */
regs->sp = (unsigned long) frame;