diff options
author | Daniel Axtens <dja@axtens.net> | 2021-02-26 19:12:58 -0600 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2021-03-29 12:52:23 +1100 |
commit | 0f92433b8f9f76608528101e7a81cd3bfd00e236 (patch) | |
tree | 6c333fd4b4be47cd4007cf38ab89b3c050af1858 /arch/powerpc/kernel/signal_64.c | |
parent | 96d7a4e06fab9fbc4f67c563af65b073902f3e61 (diff) | |
download | linux-0f92433b8f9f76608528101e7a81cd3bfd00e236.tar.gz linux-0f92433b8f9f76608528101e7a81cd3bfd00e236.tar.bz2 linux-0f92433b8f9f76608528101e7a81cd3bfd00e236.zip |
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: Christopher M. Riedl <cmr@codefail.de>
Signed-off-by: Daniel Axtens <dja@axtens.net>
Signed-off-by: Christopher M. Riedl <cmr@codefail.de>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20210227011259.11992-10-cmr@codefail.de
Diffstat (limited to 'arch/powerpc/kernel/signal_64.c')
-rw-r--r-- | arch/powerpc/kernel/signal_64.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/signal_64.c b/arch/powerpc/kernel/signal_64.c index 057507138320..e7d612e82363 100644 --- a/arch/powerpc/kernel/signal_64.c +++ b/arch/powerpc/kernel/signal_64.c @@ -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); |