Commit 0f92433b authored by Daniel Axtens's avatar Daniel Axtens Committed by Michael Ellerman

powerpc/signal64: Rewrite rt_sigreturn() to minimise uaccess switches

Add uaccess blocks and use the 'unsafe' versions of functions doing user
access where possible to reduce the number of times uaccess has to be
opened/closed.
Co-developed-by: default avatarChristopher M. Riedl <cmr@codefail.de>
Signed-off-by: default avatarDaniel Axtens <dja@axtens.net>
Signed-off-by: default avatarChristopher M. Riedl <cmr@codefail.de>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210227011259.11992-10-cmr@codefail.de
parent 96d7a4e0
......@@ -822,11 +822,11 @@ SYSCALL_DEFINE0(rt_sigreturn)
*/
current->thread.regs->msr &= ~MSR_TS_MASK;
if (!user_read_access_begin(&uc->uc_mcontext, sizeof(uc->uc_mcontext)))
return -EFAULT;
if (__unsafe_restore_sigcontext(current, NULL, 1, &uc->uc_mcontext)) {
user_read_access_end();
goto badframe;
}
unsafe_restore_sigcontext(current, NULL, 1, &uc->uc_mcontext,
badframe_block);
user_read_access_end();
}
......@@ -836,6 +836,8 @@ SYSCALL_DEFINE0(rt_sigreturn)
set_thread_flag(TIF_RESTOREALL);
return 0;
badframe_block:
user_read_access_end();
badframe:
signal_fault(current, regs, "rt_sigreturn", uc);
......
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