[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190328095119.e78ffbf9db138a24fbe18c69@kernel.org>
Date: Thu, 28 Mar 2019 09:51:19 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Sasha Levin <sashal@...nel.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Andrea Righi <righi.andrea@...il.com>,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Jiri Olsa <jolsa@...hat.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Peter Zijlstra <peterz@...radead.org>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>
Subject: Re: [PATCH AUTOSEL 5.0 152/262] x86/kprobes: Prohibit probing on
IRQ handlers directly
Hi Sasha,
Could you drop this?
This prevents probing too much functions, and we will drop it
from upstream. Anyway, commit a50480cb6d61 ("kprobes/x86:
Blacklist non-attachable interrupt functions") fixes same issue.
So please pick it instead of this.
Thank you,
On Wed, 27 Mar 2019 14:00:07 -0400
Sasha Levin <sashal@...nel.org> wrote:
> From: Masami Hiramatsu <mhiramat@...nel.org>
>
> [ Upstream commit 0eae81dc9f026d899c70f3931bf3bca6d7aa6938 ]
>
> Prohibit probing on IRQ handlers in irqentry_text because
> if it interrupts user mode, at that point we haven't changed
> to kernel space yet and which eventually leads a double fault.
> E.g.
>
> # echo p apic_timer_interrupt > kprobe_events
> # echo 1 > events/kprobes/enable
> PANIC: double fault, error_code: 0x0
> CPU: 1 PID: 814 Comm: less Not tainted 4.20.0-rc3+ #30
> Hardware name: QEMU Standard PC (i440FX + PIIX, 1996)
> RIP: 0010:error_entry+0x12/0xf0
> [snip]
> Call Trace:
> <ENTRY_TRAMPOLINE>
> ? native_iret+0x7/0x7
> ? async_page_fault+0x8/0x30
> ? trace_hardirqs_on_thunk+0x1c/0x1c
> ? error_entry+0x7c/0xf0
> ? async_page_fault+0x8/0x30
> ? native_iret+0x7/0x7
> ? int3+0xa/0x20
> ? trace_hardirqs_on_thunk+0x1c/0x1c
> ? error_entry+0x7c/0xf0
> ? int3+0xa/0x20
> ? apic_timer_interrupt+0x1/0x20
> </ENTRY_TRAMPOLINE>
> Kernel panic - not syncing: Machine halted.
> Kernel Offset: disabled
> ---[ end Kernel panic - not syncing: Machine halted. ]---
>
> Signed-off-by: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: Alexander Shishkin <alexander.shishkin@...ux.intel.com>
> Cc: Andrea Righi <righi.andrea@...il.com>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Link: http://lkml.kernel.org/r/154998796400.31052.8406236614820687840.stgit@devbox
> Signed-off-by: Ingo Molnar <mingo@...nel.org>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
> arch/x86/kernel/kprobes/core.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c
> index 4ba75afba527..a034cb808e7e 100644
> --- a/arch/x86/kernel/kprobes/core.c
> +++ b/arch/x86/kernel/kprobes/core.c
> @@ -1028,6 +1028,13 @@ NOKPROBE_SYMBOL(kprobe_fault_handler);
>
> int __init arch_populate_kprobe_blacklist(void)
> {
> + int ret;
> +
> + ret = kprobe_add_area_blacklist((unsigned long)__irqentry_text_start,
> + (unsigned long)__irqentry_text_end);
> + if (ret)
> + return ret;
> +
> return kprobe_add_area_blacklist((unsigned long)__entry_text_start,
> (unsigned long)__entry_text_end);
> }
> --
> 2.19.1
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists