[patch 3/8] x86/entry/common: Mark syscall entry points notrace/nokprobe

From: Thomas Gleixner
Date: Tue Feb 25 2020 - 18:26:01 EST


Anything before enter_from_user_mode() is not safe to be traced or probed.

Signed-off-by: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
---
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
@@ -314,11 +314,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_fixups();
do_syscall_64_irqs_on(nr, regs);
}
+NOKPROBE_SYMBOL(do_syscall_64);
#endif

#if defined(CONFIG_X86_32) || defined(CONFIG_IA32_EMULATION)
@@ -369,11 +370,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_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)
@@ -449,10 +451,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_fixups();
return do_fast_syscall_32_irqs_on(regs);
}
+NOKPROBE_SYMBOL(do_fast_syscall_32);

#endif /* CONFIG_X86_32 || CONFIG_IA32_EMULATION */