[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191021181337.a1f886fa62b400023c576be0@kernel.org>
Date: Mon, 21 Oct 2019 18:13:37 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Sami Tolvanen <samitolvanen@...gle.com>,
Will Deacon <will@...nel.org>,
Catalin Marinas <catalin.marinas@....com>,
Ard Biesheuvel <ard.biesheuvel@...aro.org>,
Dave Martin <Dave.Martin@....com>,
Kees Cook <keescook@...omium.org>,
Laura Abbott <labbott@...hat.com>,
Mark Rutland <mark.rutland@....com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
clang-built-linux@...glegroups.com,
kernel-hardening@...ts.openwall.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: Re: [PATCH 10/18] kprobes: fix compilation without
CONFIG_KRETPROBES
On Fri, 18 Oct 2019 13:02:57 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
>
> Added Masami who's the maintainer of kprobes.
>
> -- Steve
>
>
> On Fri, 18 Oct 2019 09:10:25 -0700
> Sami Tolvanen <samitolvanen@...gle.com> wrote:
>
> > kprobe_on_func_entry and arch_kprobe_on_func_entry need to be available
> > even if CONFIG_KRETPROBES is not selected.
Good catch! Since nowadays all arch supports kretprobes, I've missed to
test it.
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Thank you,
> >
> > Signed-off-by: Sami Tolvanen <samitolvanen@...gle.com>
> > ---
> > kernel/kprobes.c | 38 +++++++++++++++++++-------------------
> > 1 file changed, 19 insertions(+), 19 deletions(-)
> >
> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 53534aa258a6..b5e20a4669b8 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -1829,6 +1829,25 @@ unsigned long __weak arch_deref_entry_point(void *entry)
> > return (unsigned long)entry;
> > }
> >
> > +bool __weak arch_kprobe_on_func_entry(unsigned long offset)
> > +{
> > + return !offset;
> > +}
> > +
> > +bool kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset)
> > +{
> > + kprobe_opcode_t *kp_addr = _kprobe_addr(addr, sym, offset);
> > +
> > + if (IS_ERR(kp_addr))
> > + return false;
> > +
> > + if (!kallsyms_lookup_size_offset((unsigned long)kp_addr, NULL, &offset) ||
> > + !arch_kprobe_on_func_entry(offset))
> > + return false;
> > +
> > + return true;
> > +}
> > +
> > #ifdef CONFIG_KRETPROBES
> > /*
> > * This kprobe pre_handler is registered with every kretprobe. When probe
> > @@ -1885,25 +1904,6 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
> > }
> > NOKPROBE_SYMBOL(pre_handler_kretprobe);
> >
> > -bool __weak arch_kprobe_on_func_entry(unsigned long offset)
> > -{
> > - return !offset;
> > -}
> > -
> > -bool kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset)
> > -{
> > - kprobe_opcode_t *kp_addr = _kprobe_addr(addr, sym, offset);
> > -
> > - if (IS_ERR(kp_addr))
> > - return false;
> > -
> > - if (!kallsyms_lookup_size_offset((unsigned long)kp_addr, NULL, &offset) ||
> > - !arch_kprobe_on_func_entry(offset))
> > - return false;
> > -
> > - return true;
> > -}
> > -
> > int register_kretprobe(struct kretprobe *rp)
> > {
> > int ret = 0;
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists