[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAYs2=h7jQMAHyixusGneXSvHACaS+7YDxNE5pCfJotjHpOkxA@mail.gmail.com>
Date: Tue, 22 Nov 2022 09:46:40 +0000
From: Song Shuai <suagrfillet@...il.com>
To: Conor Dooley <conor.dooley@...rochip.com>, guoren@...nel.org
Cc: rostedt@...dmis.org, mhiramat@...nel.org, mark.rutland@....com,
paul.walmsley@...ive.com, palmer@...belt.com,
aou@...s.berkeley.edu, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] riscv/ftrace: fix ftrace_modify_call bug
Conor Dooley <conor.dooley@...rochip.com> 于2022年11月22日周二 08:57写道:
>
> On Tue, Nov 22, 2022 at 03:54:40PM +0800, Song Shuai wrote:
> > With this commit (riscv: ftrace: Reduce the detour code size to half)
>
> AFAICT the above patch has not been applied & this patch here should be
> folded into the offending patch?
> I've marked this one as "Not Applicable" in patchwork as a result, but
> let me know if that is an incorrect assumption.
>
> Thanks,
> Conor.
>
Hi, Conor:
Sorry to disturb you with this patch without against the merged commit list,
This patch actually is created for fixing (riscv: ftrace: Reduce the
detour code size to half)
which has not been merged yet.
As Guo replied, he will fold it in the target patch. You can ignore
this one. Sorry again.
BTW, for dispelling your confusion about my email name.
Actually, it was misspelled when registering, but I keep it for daily use.
So you can send it without concern. :P
-- Song
Sorry for bothering you with the
> > patched, ftrace bug occurred When hosting kprobe and function tracer
> > at the same function.
> >
> > Obviously, the variable caller in ftrace_modify_call was assigned by
> > rec->ip with 4 offset failing the code replacing at function entry.
> > And the caller should be assigned by rec->ip directly to indicate
> > the function entry.
> >
> > The following is the ftrace bug log.
> >
> > ```
> > [ 419.632855] 00000000f8776803: expected (ffe00297 1a4282e7) but got (1a8282e7 f0227179)
> > [ 419.633390] ------------[ ftrace bug ]------------
> > [ 419.633553] ftrace failed to modify
> > [ 419.633569] [<ffffffff802091cc>] kernel_read+0x0/0x52
> > [ 419.633863] actual: 97:02:e0:ff:e7:82:82:1a
> > [ 419.634087] Updating ftrace call site to call a different ftrace function
> > [ 419.634279] ftrace record flags: e0000002
> > [ 419.634487] (2) R
> > [ 419.634487] expected tramp: ffffffff800093cc
> > [ 419.634935] ------------[ cut here ]------------
> > ```
> >
> > Signed-off-by: Song Shuai <suagrfillet@...il.com>
> > ---
> > arch/riscv/kernel/ftrace.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/arch/riscv/kernel/ftrace.c b/arch/riscv/kernel/ftrace.c
> > index 8c77f236fc71..61b24d767e2e 100644
> > --- a/arch/riscv/kernel/ftrace.c
> > +++ b/arch/riscv/kernel/ftrace.c
> > @@ -132,7 +132,7 @@ int ftrace_modify_call(struct dyn_ftrace *rec, unsigned long old_addr,
> > unsigned long addr)
> > {
> > unsigned int call[2];
> > - unsigned long caller = rec->ip + 4;
> > + unsigned long caller = rec->ip;
> > int ret;
> >
> > make_call_t0(caller, old_addr, call);
> > --
> > 2.20.1
> >
Powered by blists - more mailing lists