[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190820094041.7072d90b@xhacker.debian>
Date: Tue, 20 Aug 2019 01:51:52 +0000
From: Jisheng Zhang <Jisheng.Zhang@...aptics.com>
To: "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>
CC: Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
Borislav Petkov <bp@...en8.de>,
Catalin Marinas <catalin.marinas@....com>,
"David S. Miller" <davem@...emloft.net>,
"H. Peter Anvin" <hpa@...or.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Steven Rostedt <rostedt@...dmis.org>,
Thomas Gleixner <tglx@...utronix.de>,
Will Deacon <will@...nel.org>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"x86@...nel.org" <x86@...nel.org>
Subject: Re: [PATCH 1/4] kprobes: adjust kprobe addr for KPROBES_ON_FTRACE
On Mon, 19 Aug 2019 22:13:02 +0530 "Naveen N. Rao" wrote:
> CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe.
>
>
> Jisheng Zhang wrote:
> > For KPROBES_ON_FTRACE case, we need to adjust the kprobe's addr
> > correspondingly.
> >
> > Signed-off-by: Jisheng Zhang <Jisheng.Zhang@...aptics.com>
> > ---
> > kernel/kprobes.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 9873fc627d61..f8400753a8a9 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -1560,6 +1560,9 @@ int register_kprobe(struct kprobe *p)
> > addr = kprobe_addr(p);
> > if (IS_ERR(addr))
> > return PTR_ERR(addr);
> > +#ifdef CONFIG_KPROBES_ON_FTRACE
> > + addr = (kprobe_opcode_t *)ftrace_call_adjust((unsigned long)addr);
> > +#endif
> > p->addr = addr;
>
> I'm not sure what this is achieving, but looks wrong to me.
Indeed, I didn't take care of non-ftrace addr when KPROBES_ON_FTRACE, will
update in next version.
thanks
>
> If you intend to have kprobes default to using ftrace entry for probing
> functions, consider over-riding kprobe_lookup_name() -- see powerpc
> variant for example.
>
>
> - Naveen
>
Powered by blists - more mailing lists