[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YujpFUB8KlkOgzyb@krava>
Date: Tue, 2 Aug 2022 11:06:29 +0200
From: Jiri Olsa <olsajiri@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Jiri Olsa <olsajiri@...il.com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
linux-kernel@...r.kernel.org, bpf@...r.kernel.org,
naveen.n.rao@...ux.ibm.com, anil.s.keshavamurthy@...el.com,
davem@...emloft.net, mhiramat@...nel.org, peterz@...radead.org,
mingo@...nel.org, ast@...nel.org, daniel@...earbox.net
Subject: Re: [PATCH v3] kprobes: Forbid probing on trampoline and bpf prog
On Mon, Aug 01, 2022 at 04:51:46PM -0400, Steven Rostedt wrote:
> On Mon, 1 Aug 2022 22:41:19 +0200
> Jiri Olsa <olsajiri@...il.com> wrote:
>
> > LGTM cc-ing Steven because it affects ftrace as well
>
> Thanks for the Cc, but I don't quite see how it affects ftrace.
>
> Unless you are just saying how it can affect kprobe_events?
nope, I just saw the 'ftrace' in changelog ;-)
anyway the patch makes check_kprobe_address_safe to fail
on ftrace trampoline address.. but not sure you could make
kprobe on ftrace trampoline before, probably not
jirka
>
> -- Steve
>
>
> >
> > jirka
> >
> > >
> > > v1 -> v2:
> > > Check core_kernel_text and is_module_text_address rather than
> > > only kprobe_insn.
> > > Also fix title and commit message for this. See old patch at [1].
> > > ---
> > > kernel/kprobes.c | 3 ++-
> > > 1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > > index f214f8c088ed..80697e5e03e4 100644
> > > --- a/kernel/kprobes.c
> > > +++ b/kernel/kprobes.c
> > > @@ -1560,7 +1560,8 @@ static int check_kprobe_address_safe(struct kprobe *p,
> > > preempt_disable();
> > >
> > > /* Ensure it is not in reserved area nor out of text */
> > > - if (!kernel_text_address((unsigned long) p->addr) ||
> > > + if (!(core_kernel_text((unsigned long) p->addr) ||
> > > + is_module_text_address((unsigned long) p->addr)) ||
> > > within_kprobe_blacklist((unsigned long) p->addr) ||
> > > jump_label_text_reserved(p->addr, p->addr) ||
> > > static_call_text_reserved(p->addr, p->addr) ||
> > > --
> > > 2.17.1
> > >
>
Powered by blists - more mailing lists