[lkml]   [2020]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[patch part-II V2 06/13] x86/entry/common: Mark syscall entry points notrace and NOKPROBE
The entry code has some limitations for instrumentation. Anything before
invoking enter_from_user_mode() cannot be probed because kprobes depend on
RCU and with NOHZ_FULL user mode can be accounted similar to idle from a
RCU point of view. enter_from_user_mode() calls into context tracking which
adjusts the RCU state.

A similar problem exists vs. function tracing. The function entry/exit
points can be used by BPF which again is not safe before CONTEXT_KERNEL has
been reached.

Mark the C-entry points for the various syscalls with notrace and

Note, that this still leaves the ASM invocations of trace_hardirqs_off()
unprotected. While this is safe vs. RCU at least from the ftrace POV, these
are trace points which can be utilized by BPF... This will be addressed in
later patches.

Signed-off-by: Thomas Gleixner <>
Reviewed-by: Alexandre Chartre <>
V2: Amend changelog
arch/x86/entry/common.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

--- a/arch/x86/entry/common.c
+++ b/arch/x86/entry/common.c
@@ -315,11 +315,12 @@ void do_syscall_64_irqs_on(unsigned long

-__visible void do_syscall_64(unsigned long nr, struct pt_regs *regs)
+__visible notrace void do_syscall_64(unsigned long nr, struct pt_regs *regs)
do_syscall_64_irqs_on(nr, regs);

#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
@@ -370,11 +371,12 @@ static __always_inline void do_syscall_3

/* Handles int $0x80 */
-__visible void do_int80_syscall_32(struct pt_regs *regs)
+__visible notrace void do_int80_syscall_32(struct pt_regs *regs)

/* Fast syscall 32bit variant */
static __always_inline long do_fast_syscall_32_irqs_on(struct pt_regs *regs)
@@ -450,10 +452,11 @@ static __always_inline long do_fast_sysc

/* Returns 0 to return using IRET or 1 to return using SYSEXIT/SYSRETL. */
-__visible long do_fast_syscall_32(struct pt_regs *regs)
+__visible notrace long do_fast_syscall_32(struct pt_regs *regs)
return do_fast_syscall_32_irqs_on(regs);

#endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */
 \ /
  Last update: 2020-03-09 00:26    [W:0.233 / U:11.408 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site