• Masami Hiramatsu's avatar
    kprobes/x86: Call exception handlers directly from do_int3/do_debug · 6f6343f5
    Masami Hiramatsu authored
    To avoid a kernel crash by probing on lockdep code, call
    kprobe_int3_handler() and kprobe_debug_handler()(which was
    formerly called post_kprobe_handler()) directly from
    do_int3 and do_debug.
    
    Currently kprobes uses notify_die() to hook the int3/debug
    exceptoins. Since there is a locking code in notify_die,
    the lockdep code can be invoked. And because the lockdep
    involves printk() related things, theoretically, we need to
    prohibit probing on such code, which means much longer blacklist
    we'll have. Instead, hooking the int3/debug for kprobes before
    notify_die() can avoid this problem.
    
    Anyway, most of the int3 handlers in the kernel are already
    called from do_int3 directly, e.g. ftrace_int3_handler,
    poke_int3_handler, kgdb_ll_trap. Actually only
    kprobe_exceptions_notify is on the notifier_call_chain.
    Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Reviewed-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Borislav Petkov <bp@suse.de>
    Cc: Jiri Kosina <jkosina@suse.cz>
    Cc: Jonathan Lebon <jlebon@redhat.com>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Rusty Russell <rusty@rustcorp.com.au>
    Cc: Seiji Aguchi <seiji.aguchi@hds.com>
    Link: http://lkml.kernel.org/r/20140417081733.26341.24423.stgit@ltc230.yrl.intra.hitachi.co.jpSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
    6f6343f5
core.c 31.1 KB