@@ -9,6 +9,7 @@ struct pt_regs;
* to generic entry once they are semantically equivalent.
*/
long syscall_enter_from_user_mode(struct pt_regs *regs, long);
+void syscall_exit_to_user_mode(struct pt_regs *regs);
void irqentry_enter_from_user_mode(struct pt_regs *regs);
void irqentry_exit_to_user_mode(struct pt_regs *regs);
@@ -23,7 +23,6 @@ typedef struct {
#include <asm/sigcontext.h>
-void do_rseq_syscall(struct pt_regs *regs);
void do_work_pending(struct pt_regs *regs, unsigned int thread_flags);
#endif
@@ -65,12 +65,9 @@ ret_fast_syscall:
UNWIND(.fnstart )
UNWIND(.cantunwind )
add sp, sp, #(S_R0 + S_OFF)
-#if IS_ENABLED(CONFIG_DEBUG_RSEQ)
/* do_rseq_syscall needs interrupts enabled. */
mov r0, sp @ 'regs'
- bl do_rseq_syscall
-#endif
- disable_irq_notrace @ disable interrupts
+ bl syscall_exit_to_user_mode
ldr r1, [tsk, #TI_FLAGS] @ re-check for syscall tracing
movs r1, r1, lsl #16
beq no_work_pending
@@ -97,13 +94,10 @@ ENDPROC(ret_fast_syscall)
* do_work_pending() will update this state if necessary.
*/
ENTRY(ret_to_user)
-#if IS_ENABLED(CONFIG_DEBUG_RSEQ)
/* do_rseq_syscall needs interrupts enabled. */
enable_irq_notrace @ enable interrupts
mov r0, sp @ 'regs'
- bl do_rseq_syscall
-#endif
- disable_irq_notrace @ disable interrupts
+ bl syscall_exit_to_user_mode
ENTRY(ret_to_user_from_irq)
ldr r1, [tsk, #TI_FLAGS]
movs r1, r1, lsl #16
@@ -1,7 +1,9 @@
// SPDX-License-Identifier: GPL-2.0
#include <asm/entry.h>
+#include <asm/signal.h>
#include <linux/context_tracking.h>
#include <linux/irqflags.h>
+#include <linux/rseq.h>
long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
{
@@ -14,6 +16,12 @@ long syscall_enter_from_user_mode(struct pt_regs *regs, long syscall)
return syscall;
}
+void syscall_exit_to_user_mode(struct pt_regs *regs)
+{
+ rseq_syscall(regs);
+ local_irq_disable();
+}
+
noinstr void irqentry_enter_from_user_mode(struct pt_regs *regs)
{
trace_hardirqs_off();
@@ -659,13 +659,6 @@ struct page *get_signal_page(void)
return page;
}
-#ifdef CONFIG_DEBUG_RSEQ
-asmlinkage void do_rseq_syscall(struct pt_regs *regs)
-{
- rseq_syscall(regs);
-}
-#endif
-
/*
* Compile-time assertions for siginfo_t offsets. Check NSIG* as well, as
* changes likely come with new fields that should be added below.
Mirroring syscall_enter_from_user_mode() we create the sibling call syscall_exit_to_user_mode() and start to move some stuff over from assembly, first the rseq call and the interrupt disablement. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> --- arch/arm/include/asm/entry.h | 1 + arch/arm/include/asm/signal.h | 1 - arch/arm/kernel/entry-common.S | 10 ++-------- arch/arm/kernel/entry.c | 8 ++++++++ arch/arm/kernel/signal.c | 7 ------- 5 files changed, 11 insertions(+), 16 deletions(-)