lkml.org 
[lkml]   [2020]   [Mar]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch V3 04/23] kprobes: Prevent probes in .noinstr.text section
On Tue, 24 Mar 2020 10:47:30 +0100
Thomas Gleixner <tglx@linutronix.de> wrote:

> Masami Hiramatsu <mhiramat@kernel.org> writes:
> > On Mon, 23 Mar 2020 17:03:24 +0100
> > Thomas Gleixner <tglx@linutronix.de> wrote:
> >> > @@ -2212,6 +2212,10 @@ static int __init populate_kprobe_blacklist(unsigned long *start,
> >> > ret = kprobe_add_area_blacklist((unsigned long)__kprobes_text_start,
> >> > (unsigned long)__kprobes_text_end);
> >> >
> >> > + /* Symbols in noinstr section are blacklisted */
> >> > + ret = kprobe_add_area_blacklist((unsigned long)__noinstr_text_start,
> >> > + (unsigned long)__noinstr_text_end);
> >> > +
> >> > return ret ? : arch_populate_kprobe_blacklist();
> >> > }
> >>
> >> So that extra function is not required when adding that, right?
> >
> > That's right :)
> >
> >>
> >> >> +/* Functions in .noinstr.text must not be probed */
> >> >> +static bool within_noinstr_text(unsigned long addr)
> >> >> +{
> >> >> + /* FIXME: Handle module .noinstr.text */
> >
> > And this reminds me that the module .kprobes.text is not handled yet :(.
>
> Correct. Any idea how to do that with a simple oneliner like the above?

Hmm, we can store the .kprobes.text and .noinstr.text section info in the struct
module and register it in module callback. But before that, I have to introduce
a remove function. Currently, the blacklist can only add symbols. So that will
not be a oneliner.

Let me try.

Thank you,


--
Masami Hiramatsu <mhiramat@kernel.org>

\
 
 \ /
  Last update: 2020-03-25 14:40    [W:0.060 / U:11.388 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site