From: Masami Hiramatsu <mhiramat@kernel.org>
To: Ingo Molnar <mingo@redhat.com>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
peterz@infradead.org,
Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Andrea Righi <righi.andrea@gmail.com>,
Steven Rostedt <rostedt@goodmis.org>
Subject: [PATCH v2 4/9] x86/kprobes: Prohibit probing on IRQ handlers directly
Date: Sat, 12 Jan 2019 11:27:34 +0900 [thread overview]
Message-ID: <154726005388.18060.5793514938380284862.stgit@devbox> (raw)
In-Reply-To: <154725993986.18060.2759150647140353514.stgit@devbox>
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@kernel.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 f4b954ff5b89..fed46ddb1eef 100644
--- a/arch/x86/kernel/kprobes/core.c
+++ b/arch/x86/kernel/kprobes/core.c
@@ -1072,6 +1072,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);
}
next prev parent reply other threads:[~2019-01-12 2:27 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-12 2:25 [PATCH v2 0/9] kprobes: Fix and improve blacklist symbols Masami Hiramatsu
2019-01-12 2:26 ` [PATCH v2 1/9] x86/kprobes: Prohibit probing on optprobe template code Masami Hiramatsu
2019-01-12 2:26 ` [PATCH v2 2/9] x86/kprobes: Move trampoline code into RODATA Masami Hiramatsu
2019-01-12 2:27 ` [PATCH v2 3/9] x86/kprobes: Prohibit probing on functions before kprobe_int3_handler() Masami Hiramatsu
2019-01-12 2:27 ` Masami Hiramatsu [this message]
2019-01-12 2:28 ` [PATCH v2 5/9] kprobes: Search non-suffixed symbol in blacklist Masami Hiramatsu
2019-01-14 16:16 ` Steven Rostedt
2019-01-12 2:28 ` [PATCH v2 6/9] kprobes: Prohibit probing on hardirq tracers Masami Hiramatsu
2019-01-12 2:28 ` [PATCH v2 7/9] kprobes: Prohibit probing on preempt_check debug functions Masami Hiramatsu
2019-01-12 2:29 ` [PATCH v2 8/9] kprobes: Prohibit probing on RCU debug routine Masami Hiramatsu
2019-01-12 2:29 ` [PATCH v2 9/9] kprobes: Prohibit probing on lockdep functions Masami Hiramatsu
2019-01-12 13:33 ` [PATCH v2 0/9] kprobes: Fix and improve blacklist symbols Andrea Righi
2019-01-13 14:23 ` Masami Hiramatsu
2019-01-14 16:18 ` Steven Rostedt
2019-02-01 13:31 ` Masami Hiramatsu
2019-02-11 13:50 ` Ingo Molnar
2019-02-12 16:48 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=154726005388.18060.5793514938380284862.stgit@devbox \
--to=mhiramat@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=righi.andrea@gmail.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox