Call the rseq_handle_notify_resume() function on return to userspace if TIF_NOTIFY_RESUME thread flag is set.
Increment the event counter and perform fixup on the pre-signal frame when a signal is delivered on top of a restartable sequence critical section. Signed-off-by: Mathieu Desnoyers <mathieu.desnoy...@efficios.com> CC: Russell King <li...@arm.linux.org.uk> CC: Catalin Marinas <catalin.mari...@arm.com> CC: Will Deacon <will.dea...@arm.com> CC: Thomas Gleixner <t...@linutronix.de> CC: Paul Turner <p...@google.com> CC: Andrew Hunter <a...@google.com> CC: Peter Zijlstra <pet...@infradead.org> CC: Andy Lutomirski <l...@amacapital.net> CC: Andi Kleen <a...@firstfloor.org> CC: Dave Watson <davejwat...@fb.com> CC: Chris Lameter <c...@linux.com> CC: Ingo Molnar <mi...@redhat.com> CC: "H. Peter Anvin" <h...@zytor.com> CC: Ben Maurer <bmau...@fb.com> CC: Steven Rostedt <rost...@goodmis.org> CC: "Paul E. McKenney" <paul...@linux.vnet.ibm.com> CC: Josh Triplett <j...@joshtriplett.org> CC: Linus Torvalds <torva...@linux-foundation.org> CC: Andrew Morton <a...@linux-foundation.org> CC: Boqun Feng <boqun.f...@gmail.com> CC: linux-...@vger.kernel.org --- arch/x86/Kconfig | 1 + arch/x86/entry/common.c | 1 + arch/x86/kernel/signal.c | 6 ++++++ 3 files changed, 8 insertions(+) diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig index 323cb065be5e..b2ce9970bc9c 100644 --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -170,6 +170,7 @@ config X86 select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if X86_64 && FRAME_POINTER && STACK_VALIDATION select HAVE_STACK_VALIDATION if X86_64 + select HAVE_RSEQ select HAVE_SYSCALL_TRACEPOINTS select HAVE_UNSTABLE_SCHED_CLOCK select HAVE_USER_RETURN_NOTIFIER diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index cdefcfdd9e63..2077086ecb94 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -159,6 +159,7 @@ static void exit_to_usermode_loop(struct pt_regs *regs, u32 cached_flags) if (cached_flags & _TIF_NOTIFY_RESUME) { clear_thread_flag(TIF_NOTIFY_RESUME); tracehook_notify_resume(regs); + rseq_handle_notify_resume(regs); } if (cached_flags & _TIF_USER_RETURN_NOTIFY) diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c index cc30a74e4adb..61adc59cde3f 100644 --- a/arch/x86/kernel/signal.c +++ b/arch/x86/kernel/signal.c @@ -686,6 +686,12 @@ setup_rt_frame(struct ksignal *ksig, struct pt_regs *regs) sigset_t *set = sigmask_to_save(); compat_sigset_t *cset = (compat_sigset_t *) set; + /* + * Increment event counter and perform fixup for the pre-signal + * frame. + */ + rseq_signal_deliver(regs); + /* Set up the stack frame */ if (is_ia32_frame(ksig)) { if (ksig->ka.sa.sa_flags & SA_SIGINFO) -- 2.11.0