From: Masami Hiramatsu <mhiramat@kernel.org>
To: Francis Deslauriers <francis.deslauriers@efficios.com>
Cc: tglx@linutronix.de, mingo@redhat.com, peterz@infradead.org,
mathieu.desnoyers@efficios.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/1] x86/kprobes: Prohibit probing of .entry_trampoline code
Date: Sat, 10 Mar 2018 00:15:22 +0900 [thread overview]
Message-ID: <20180310001522.5b81074c7c7ec24cfb5f0a06@kernel.org> (raw)
In-Reply-To: <1520565492-4637-1-git-send-email-francis.deslauriers@efficios.com>
On Thu, 8 Mar 2018 22:18:11 -0500
Francis Deslauriers <francis.deslauriers@efficios.com> wrote:
> Hi all,
>
> While fuzzing the Perf kprobe interface, I found that adding a probe on
> the 'entry_SYSCALL_64_trampoline' symbol will crash my 4.16-rc4
> kernel(661e50bc853209e41a5c14a290ca4decc43cbfd1) on a x86_64 Qemu VM.
>
> How to reproduce:
> echo 'p:event1 entry_SYSCALL_64_trampoline' > ./kprobe_events
> echo 1 > events/kprobes/enable
> Crash log:[1]
>
> My understanding is that the userspace CR3 register has not yet been
> replaced by the kernel's CR3, when the kprobe is triggered. This means
> that the kernel addresses can not be translated, thus making the
> handling of the kprobe impossible.
Thanks for reporting!
And yes, all entry code must be nokprobe.
>
> This can be fixed by blacklisting the .entry_trampoline section. See
> patch[1/1].
>
> Here is the config I am using[2].
>
> Thanks,
>
> Francis Deslauriers
> EfficiOS inc.
>
> 1:http://paste.ubuntu.com/p/djnpZCzQKv/
> 2:http://paste.ubuntu.com/p/3jrFYt6XQB/
>
> Francis Deslauriers (1):
> x86/kprobes: Prohibit probing of .entry_trampoline code
>
> arch/x86/include/asm/sections.h | 1 +
> arch/x86/kernel/kprobes/core.c | 10 +++++++++-
> arch/x86/kernel/vmlinux.lds.S | 2 ++
> 3 files changed, 12 insertions(+), 1 deletion(-)
>
> --
> 2.7.4
>
--
Masami Hiramatsu <mhiramat@kernel.org>
prev parent reply other threads:[~2018-03-09 15:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-09 3:18 Francis Deslauriers
2018-03-09 3:18 ` [PATCH 1/1] " Francis Deslauriers
2018-03-09 15:17 ` Masami Hiramatsu
2018-03-10 7:07 ` [tip:x86/pti] x86/kprobes: Fix kernel crash when probing " tip-bot for Francis Deslauriers
2018-03-09 15:15 ` Masami Hiramatsu [this message]
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=20180310001522.5b81074c7c7ec24cfb5f0a06@kernel.org \
--to=mhiramat@kernel.org \
--cc=francis.deslauriers@efficios.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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
Powered by JetHome