linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	"Masami Hiramatsu (Google)" <mhiramat@kernel.org>,
	Borislav Petkov <bp@suse.de>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@kernel.org>
Subject: Re: CONFIG_RETHUNK int3 filling prevents kprobes in function body
Date: Tue, 6 Sep 2022 10:30:18 +0900	[thread overview]
Message-ID: <20220906103018.50f46e8c21c4a40b2d635c75@kernel.org> (raw)
In-Reply-To: <YxYTvgTqRP0GMAjO@hirez.programming.kicks-ass.net>

On Mon, 5 Sep 2022 17:20:30 +0200
Peter Zijlstra <peterz@infradead.org> wrote:

> On Mon, Sep 05, 2022 at 05:10:27PM +0200, Peter Zijlstra wrote:
> > On Mon, Sep 05, 2022 at 10:57:58AM -0400, Steven Rostedt wrote:
> > > On Sun, 4 Sep 2022 23:07:13 +0900
> > > Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:
> > > 
> > > > Can we use another instruction for padding instead of INT3? (e.g. NOP or UD2)
> > > > 
> > > > Or, can I expect the instruction length in __return_sites[] are always 5?
> > > > If so, I can just skip 5 bytes if the address is in __return_sites[].
> > > 
> > > Perhaps another option is to have a table of where the padding is placed
> > > (tagged), and that kprobes could check to see if the int3 is due to this
> > > padding or not?
> > 
> > I don't see need for that. If you want to be strict you can simply
> > follow the branches found earlier, if you want to be lazy, you can
> > decode until you run out of the symbol size.
> 
> Another lazy option is to teach the thing that 'ret' is followed by 0,1
> or 4 'int3' instructions depending on CONFIG_SLS, CONFIG_RETHUNK, but
> that'll get you into trouble with future SLS compiler options, like the
> aforementioned JMP-SLS option.

Yes, I agree... OK, let me try to decode branches to find the
nearest earlier target instruction.

Thank you!

-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2022-09-06  1:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-04 14:07 CONFIG_RETHUNK int3 filling prevents kprobes in function body Masami Hiramatsu
2022-09-05 14:57 ` Steven Rostedt
2022-09-05 15:10   ` Peter Zijlstra
2022-09-05 15:20     ` Peter Zijlstra
2022-09-06  1:30       ` Masami Hiramatsu [this message]
2022-09-05 15:09 ` Peter Zijlstra
2022-09-05 15:15   ` Peter Zijlstra
2022-09-05 15:52   ` Peter Zijlstra
2022-09-06  1:33     ` Masami Hiramatsu
2022-09-06  8:44       ` Peter Zijlstra

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=20220906103018.50f46e8c21c4a40b2d635c75@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=bp@suse.de \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --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;
as well as URLs for NNTP newsgroup(s).