From: Thomas Gleixner Date: Sat, 29 Feb 2020 14:12:33 +0000 (+0100) Subject: x86/entry: Mark enter_from_user_mode() noinstr X-Git-Tag: v5.8-rc1~21^2~124 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=1723be30e46fbda0c5971d3a19a37a7c2499bc90;p=users%2Fhch%2Fmisc.git x86/entry: Mark enter_from_user_mode() noinstr Both the callers in the low level ASM code and __context_tracking_exit() which is invoked from enter_from_user_mode() via user_exit_irqoff() are marked NOKPROBE. Allowing enter_from_user_mode() to be probed is inconsistent at best. Aside of that while function tracing per se is safe the function trace entry/exit points can be used via BPF as well which is not safe to use before context tracking has reached CONTEXT_KERNEL and adjusted RCU. Mark it noinstr which moves it into the instrumentation protected text section and includes notrace. Note, this needs further fixups in context tracking to ensure that the full call chain is protected. Will be addressed in follow up changes. Signed-off-by: Thomas Gleixner Reviewed-by: Masami Hiramatsu Reviewed-by: Alexandre Chartre Acked-by: Peter Zijlstra Link: https://lkml.kernel.org/r/20200505134340.429059405@linutronix.de --- diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c index 76735ec813e6..d862add7918b 100644 --- a/arch/x86/entry/common.c +++ b/arch/x86/entry/common.c @@ -41,7 +41,7 @@ #ifdef CONFIG_CONTEXT_TRACKING /* Called on entry from user mode with IRQs off. */ -__visible inline void enter_from_user_mode(void) +__visible inline noinstr void enter_from_user_mode(void) { CT_WARN_ON(ct_state() != CONTEXT_USER); user_exit_irqoff();