Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

x86/kprobes: Fix build errors and blacklist context_track_user

This essentially reverts commit:

ecd50f714c42 ("kprobes, x86: Call exception_enter after kprobes handled")

since it causes build errors with CONFIG_CONTEXT_TRACKING and
that has been made from misunderstandings;
context_track_user_*() don't involve much in interrupt context,
it just returns if in_interrupt() is true.

Instead of changing the do_debug/int3(), this just adds
context_track_user_*() to kprobes blacklist, since those are
still can be called right before kprobes handles int3 and debug
exceptions, and probing those will cause an infinite loop.

Reported-by: Frederic Weisbecker <fweisbec@gmail.com>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Borislav Petkov <bp@suse.de>
Cc: Kees Cook <keescook@chromium.org>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Seiji Aguchi <seiji.aguchi@hds.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Kees Cook <keescook@chromium.org>
Link: http://lkml.kernel.org/r/20140614064711.7865.45957.stgit@kbuild-fedora.novalocal
Signed-off-by: Ingo Molnar <mingo@kernel.org>

authored by

Masami Hiramatsu and committed by
Ingo Molnar
4cdf77a8 ed9ea4ed

+7 -3
+4 -3
arch/x86/kernel/traps.c
··· 343 343 if (poke_int3_handler(regs)) 344 344 return; 345 345 346 + prev_state = exception_enter(); 346 347 #ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 347 348 if (kgdb_ll_trap(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 348 349 SIGTRAP) == NOTIFY_STOP) ··· 352 351 353 352 #ifdef CONFIG_KPROBES 354 353 if (kprobe_int3_handler(regs)) 355 - return; 354 + goto exit; 356 355 #endif 357 - prev_state = exception_enter(); 358 356 359 357 if (notify_die(DIE_INT3, "int3", regs, error_code, X86_TRAP_BP, 360 358 SIGTRAP) == NOTIFY_STOP) ··· 433 433 unsigned long dr6; 434 434 int si_code; 435 435 436 + prev_state = exception_enter(); 437 + 436 438 get_debugreg(dr6, 6); 437 439 438 440 /* Filter out all the reserved bits which are preset to 1 */ ··· 467 465 if (kprobe_debug_handler(regs)) 468 466 goto exit; 469 467 #endif 470 - prev_state = exception_enter(); 471 468 472 469 if (notify_die(DIE_DEBUG, "debug", regs, (long)&dr6, error_code, 473 470 SIGTRAP) == NOTIFY_STOP)
+3
kernel/context_tracking.c
··· 19 19 #include <linux/sched.h> 20 20 #include <linux/hardirq.h> 21 21 #include <linux/export.h> 22 + #include <linux/kprobes.h> 22 23 23 24 #define CREATE_TRACE_POINTS 24 25 #include <trace/events/context_tracking.h> ··· 105 104 } 106 105 local_irq_restore(flags); 107 106 } 107 + NOKPROBE_SYMBOL(context_tracking_user_enter); 108 108 109 109 #ifdef CONFIG_PREEMPT 110 110 /** ··· 183 181 } 184 182 local_irq_restore(flags); 185 183 } 184 + NOKPROBE_SYMBOL(context_tracking_user_exit); 186 185 187 186 /** 188 187 * __context_tracking_task_switch - context switch the syscall callbacks