Messages in this thread Patch in this message | | | Date | Sun, 08 Mar 2020 23:24:05 +0100 | From | Thomas Gleixner <> | 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 NOKPROBE_SYMBOL().
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 <tglx@linutronix.de> Reviewed-by: Alexandre Chartre <alexandre.chartre@oracle.com> --- 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 syscall_return_slowpath(regs); } -__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) { syscall_entry_apply_fixups(); do_syscall_64_irqs_on(nr, regs); } +NOKPROBE_SYMBOL(do_syscall_64); #endif #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) { syscall_entry_apply_fixups(); do_syscall_32_irqs_on(regs); } +NOKPROBE_SYMBOL(do_int80_syscall_32); /* 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) { syscall_entry_apply_fixups(); return do_fast_syscall_32_irqs_on(regs); } +NOKPROBE_SYMBOL(do_fast_syscall_32); #endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */
| |