From: Matthieu Baerts <matttbe@kernel.org>
To: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
x86@kernel.org, Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org,
Huacai Chen <chenhuacai@loongson.cn>,
Jinyang He <hejinyang@loongson.cn>,
Tiezhu Yang <yangtiezhu@loongson.cn>,
"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>
Subject: Re: [PATCH -tip v2] x86/kprobes: Drop removed INT3 handling code
Date: Sun, 21 Jan 2024 16:23:35 +0100 [thread overview]
Message-ID: <f8bbf989-f709-4ceb-af5c-87e1e20de914@kernel.org> (raw)
In-Reply-To: <20240121180544.8c663977651d2a18291318d5@kernel.org>
Hi Masami, Steven,
On 21/01/2024 10:05, Masami Hiramatsu (Google) wrote:
> On Sun, 21 Jan 2024 11:28:52 +0900
> Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
>
>> On Sat, 20 Jan 2024 17:05:17 -0500
>> Steven Rostedt <rostedt@goodmis.org> wrote:
>>
>>> On Sat, 20 Jan 2024 18:44:38 +0100
>>> Matthieu Baerts <matttbe@kernel.org> wrote:
>>>
>>>>
>>>> I'm sorry to reply on a patch that is more than one year old, but in
>>>
>>> No problem, I've done the same.
>>
>> Yeah, thanks for reporting! I realized the problem.
Thank you both for your quick reply, very useful explanations, analysis
and patch!
(...)
> So this another solution is already done. I think we need to add the
> ghost INT3 check in the exc_int3() as follows;
>
> Thank you,
>
> From add8cf7da99cdb096a0d6765b3dc5de9a3ea3019 Mon Sep 17 00:00:00 2001
> From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
> Date: Sun, 21 Jan 2024 17:16:50 +0900
> Subject: [PATCH] x86: Fixup from the removed INT3 if it is unhandled
>
> INT3 is used not only for software breakpoint, but also self modifying
> code on x86 in the kernel. For example, jump_label, function tracer etc.
> Those may not handle INT3 after removing it but not waiting for
> synchronizing CPUs enough. Since such 'ghost' INT3 is not handled by
> anyone because they think it has been removed already.
> Recheck there is INT3 on the exception address and if not, ignore it.
>
> Note that previously kprobes does the same thing by itself, but that is
> not a good location to do that because INT3 is commonly used. Do it at
> the common place so that it can handle all 'ghost' INT3.
I just tested it, and I was able to run pings for 3h without any issues!
While at it, and just to be on the safe side, I also re-run the tests
after having added a "pr_warn()" -- I know, using printk(), especially
when talking to you... but I was not sure what was safe to use at this
place in the code :) -- before returning "true" in the new function you
added, and we can see that the crash is avoided thanks to the new code:
[ 27.422518] traps: crash avoided, addr=18446744071882050317
[ 27.426182] traps: crash avoided, addr=18446744071882050317
[ 370.483208] traps: crash avoided, addr=18446744071882075656
[ 370.485066] traps: crash avoided, addr=18446744071882075656
[ 370.485084] traps: crash avoided, addr=18446744071882075656
[ 592.866416] traps: crash avoided, addr=18446744071882075656
[ 592.867937] traps: crash avoided, addr=18446744071882075656
[ 980.988342] traps: crash avoided, addr=18446744071882050317
[ 980.989866] traps: crash avoided, addr=18446744071882050317
(from my VM running with 2 CPU cores)
Again, thank you for the fix!
(Just in case you need it:)
Tested-by: Matthieu Baerts <matttbe@kernel.org>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
next prev parent reply other threads:[~2024-01-21 15:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-30 13:33 Masami Hiramatsu (Google)
2023-01-07 11:36 ` [tip: perf/core] " tip-bot2 for Masami Hiramatsu (Google)
2024-01-20 17:44 ` [PATCH -tip v2] " Matthieu Baerts
2024-01-20 22:05 ` Steven Rostedt
2024-01-21 2:28 ` Masami Hiramatsu
2024-01-21 9:05 ` Masami Hiramatsu
2024-01-21 15:23 ` Matthieu Baerts [this message]
2024-01-21 15:31 ` Steven Rostedt
2024-01-21 15:33 ` Steven Rostedt
2024-01-21 16:20 ` Matthieu Baerts
2024-01-21 21:59 ` Matthieu Baerts
2024-01-22 1:17 ` Masami Hiramatsu
2024-01-21 15:42 ` Steven Rostedt
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=f8bbf989-f709-4ceb-af5c-87e1e20de914@kernel.org \
--to=matttbe@kernel.org \
--cc=bp@alien8.de \
--cc=chenhuacai@loongson.cn \
--cc=hejinyang@loongson.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@redhat.com \
--cc=naveen.n.rao@linux.ibm.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yangtiezhu@loongson.cn \
/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