diff options
Diffstat (limited to 'kernel/context_tracking.c')
| -rw-r--r-- | kernel/context_tracking.c | 17 | 
1 files changed, 16 insertions, 1 deletions
diff --git a/kernel/context_tracking.c b/kernel/context_tracking.c index 247091bf058..5664985c46a 100644 --- a/kernel/context_tracking.c +++ b/kernel/context_tracking.c @@ -19,6 +19,7 @@  #include <linux/sched.h>  #include <linux/hardirq.h>  #include <linux/export.h> +#include <linux/kprobes.h>  #define CREATE_TRACE_POINTS  #include <trace/events/context_tracking.h> @@ -51,6 +52,15 @@ void context_tracking_user_enter(void)  	unsigned long flags;  	/* +	 * Repeat the user_enter() check here because some archs may be calling +	 * this from asm and if no CPU needs context tracking, they shouldn't +	 * go further. Repeat the check here until they support the inline static +	 * key check. +	 */ +	if (!context_tracking_is_enabled()) +		return; + +	/*  	 * Some contexts may involve an exception occuring in an irq,  	 * leading to that nesting:  	 * rcu_irq_enter() rcu_user_exit() rcu_user_exit() rcu_irq_exit() @@ -95,6 +105,7 @@ void context_tracking_user_enter(void)  	}  	local_irq_restore(flags);  } +NOKPROBE_SYMBOL(context_tracking_user_enter);  #ifdef CONFIG_PREEMPT  /** @@ -111,7 +122,7 @@ void context_tracking_user_enter(void)   * instead of preempt_schedule() to exit user context if needed before   * calling the scheduler.   */ -void __sched notrace preempt_schedule_context(void) +asmlinkage __visible void __sched notrace preempt_schedule_context(void)  {  	enum ctx_state prev_ctx; @@ -151,6 +162,9 @@ void context_tracking_user_exit(void)  {  	unsigned long flags; +	if (!context_tracking_is_enabled()) +		return; +  	if (in_interrupt())  		return; @@ -169,6 +183,7 @@ void context_tracking_user_exit(void)  	}  	local_irq_restore(flags);  } +NOKPROBE_SYMBOL(context_tracking_user_exit);  /**   * __context_tracking_task_switch - context switch the syscall callbacks  | 
