Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1485071
| From | Stafford Horne <shorne@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/7] openrisc: restore call-saved regs on sigreturn |
| Date | 2016-09-16 16:50 +0200 |
| Message-ID | <si2CK-608-25@gated-at.bofh.it> (permalink) |
| References | <si2CJ-608-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Jonas Bonn <jonas@southpole.se> Return to userspace via _resume_userspace instead of via syscall return path for the rt_sigreturn syscall. I'll rework this comment more later, but this patch needs testing. Old comment from previous patch: The sigreturn syscall is more like a context switch than a function call; it entails a return from one context (the signal handler) to another (the process in question). For a context switch like this there are effectively no call-saved regs that remain constant across the transition. This patch restores the call-saved regs from pt_regs before returning from the syscall, effectively restoring the context that the process had before being interrupted by the signal handler. Restoring the call-saved regs in this way allows us to return to userspace via the usual syscall fast path. Reported-by: Sebastian Macke <sebastian@macke.de> Signed-off-by: Jonas Bonn <jonas@southpole.se> Signed-off-by: Stafford Horne <shorne@gmail.com> --- arch/openrisc/kernel/entry.S | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/openrisc/kernel/entry.S b/arch/openrisc/kernel/entry.S index fec8bf9..572d223 100644 --- a/arch/openrisc/kernel/entry.S +++ b/arch/openrisc/kernel/entry.S @@ -1101,8 +1101,16 @@ ENTRY(__sys_fork) l.addi r3,r1,0 ENTRY(sys_rt_sigreturn) - l.j _sys_rt_sigreturn + l.jal _sys_rt_sigreturn l.addi r3,r1,0 + l.sfne r30,r0 + l.bnf _no_syscall_trace + l.nop + l.jal do_syscall_trace_leave + l.addi r3,r1,0 +_no_syscall_trace: + l.j _resume_userspace + l.nop /* This is a catch-all syscall for atomic instructions for the OpenRISC 1000. * The functions takes a variable number of parameters depending on which -- 2.7.4
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/7] openrisc: Misc fixes from backlog Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
[PATCH 6/7] openrisc: add SMP and NR_CPUS Kconfig options Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
Re: [PATCH 6/7] openrisc: add SMP and NR_CPUS Kconfig options Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:40 +0200
Re: [PATCH 6/7] openrisc: add SMP and NR_CPUS Kconfig options Stafford Horne <shorne@gmail.com> - 2016-09-19 17:00 +0200
[PATCH 3/7] openrisc: restore call-saved regs on sigreturn Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
Re: [PATCH 3/7] openrisc: restore call-saved regs on sigreturn Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:50 +0200
Re: [PATCH 3/7] openrisc: restore call-saved regs on sigreturn Stafford Horne <shorne@gmail.com> - 2016-09-19 17:00 +0200
[PATCH 7/7] openrisc: remove the redundant of_platform_populate Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
Re: [PATCH 7/7] openrisc: remove the redundant of_platform_populate Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:40 +0200
Re: [PATCH 7/7] openrisc: remove the redundant of_platform_populate Stafford Horne <shorne@gmail.com> - 2016-09-19 17:00 +0200
Re: [PATCH 7/7] openrisc: remove the redundant of_platform_populate Rob Herring <robh@kernel.org> - 2016-09-19 18:20 +0200
[PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-18 17:30 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 08:10 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 09:20 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 11:20 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 15:20 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 16:10 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:40 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 17:00 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-19 17:20 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Guenter Roeck <linux@roeck-us.net> - 2016-09-19 16:50 +0200
Re: [PATCH 5/7] openrisc: Support both old (or32) and new (or1k) toolchain Stafford Horne <shorne@gmail.com> - 2016-09-20 12:10 +0200
[PATCH 1/7] Apply transparent_union attribute to union semun Stafford Horne <shorne@gmail.com> - 2016-09-16 16:50 +0200
Re: [PATCH 1/7] Apply transparent_union attribute to union semun kbuild test robot <lkp@intel.com> - 2016-09-16 18:00 +0200
Re: [PATCH 1/7] Apply transparent_union attribute to union semun kbuild test robot <lkp@intel.com> - 2016-09-17 01:40 +0200
Re: [PATCH 1/7] Apply transparent_union attribute to union semun Stafford Horne <shorne@gmail.com> - 2016-09-17 02:10 +0200
Re: [PATCH 1/7] Apply transparent_union attribute to union semun Stafford Horne <shorne@gmail.com> - 2016-09-19 16:50 +0200
Re: [PATCH 1/7] Apply transparent_union attribute to union semun Jonas Bonn <jonas@southpole.se> - 2016-09-19 16:50 +0200
Re: [PATCH 0/7] openrisc: Misc fixes from backlog Stafford Horne <shorne@gmail.com> - 2016-09-16 17:00 +0200
csiph-web