From: Guo Ren <guoren@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Punit Agrawal <punitagrawal@gmail.com>,
"Naveen N . Rao" <naveen.n.rao@linux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
David Miller <davem@davemloft.net>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-csky@vger.kernel.org, Guo Ren <guoren@linux.alibaba.com>
Subject: Re: [RFC PATCH 4/5] csky: ftrace: Drop duplicate implementation of arch_check_ftrace_location()
Date: Wed, 9 Jun 2021 23:47:30 +0800 [thread overview]
Message-ID: <CAJF2gTTSFaexHqbZfHp2tMh-VbmRu+9sJPrWtKv14t6Vassv5A@mail.gmail.com> (raw)
In-Reply-To: <20210609232959.3b94659c00ad66a602653bde@kernel.org>
On Wed, Jun 9, 2021 at 10:30 PM Masami Hiramatsu <mhiramat@kernel.org> wrote:
>
> Hi Guo,
>
> On Wed, 9 Jun 2021 20:33:18 +0800
> Guo Ren <guoren@kernel.org> wrote:
>
> > csky using -mcount not -fpatchable-function-entry, so
> > /* Given address is not on the instruction boundary */
> > if ((unsigned long)p->addr != ftrace_addr)
> > return -EILSEQ;
> > all right?
>
> Even if -mcount is used, that check is still needed since the
> ftrace hooked address will be the ftrace_addr. If user tries to
> probe the second instruction in mcount code, kprobes needs to stop it.
Make sense. It guarantees p->addr is the first instruction of function
-mcount call site.
Thx
Acked-by: Guo Ren <guoren@kernel.org>
>
> Thank you,
>
> >
> > On Wed, Jun 9, 2021 at 6:51 PM Punit Agrawal <punitagrawal@gmail.com> wrote:
> > >
> > > The csky specific arch_check_ftrace_location() shadows a weak
> > > implementation of the function in core code that offers the same
> > > functionality but with additional error checking.
> > >
> > > Drop the architecture specific function as a step towards further
> > > cleanup in core code.
> > >
> > > Signed-off-by: Punit Agrawal <punitagrawal@gmail.com>
> > > Cc: Guo Ren <guoren@linux.alibaba.com>
> > > ---
> > > arch/csky/kernel/probes/ftrace.c | 7 -------
> > > 1 file changed, 7 deletions(-)
> > >
> > > diff --git a/arch/csky/kernel/probes/ftrace.c b/arch/csky/kernel/probes/ftrace.c
> > > index ef2bb9bd9605..b388228abbf2 100644
> > > --- a/arch/csky/kernel/probes/ftrace.c
> > > +++ b/arch/csky/kernel/probes/ftrace.c
> > > @@ -2,13 +2,6 @@
> > >
> > > #include <linux/kprobes.h>
> > >
> > > -int arch_check_ftrace_location(struct kprobe *p)
> > > -{
> > > - if (ftrace_location((unsigned long)p->addr))
> > > - p->flags |= KPROBE_FLAG_FTRACE;
> > > - return 0;
> > > -}
> > > -
> > > /* Ftrace callback handler for kprobes -- called under preepmt disabled */
> > > void kprobe_ftrace_handler(unsigned long ip, unsigned long parent_ip,
> > > struct ftrace_ops *ops, struct ftrace_regs *fregs)
> > > --
> > > 2.30.2
> > >
> >
> >
> > --
> > Best Regards
> > Guo Ren
> >
> > ML: https://lore.kernel.org/linux-csky/
>
>
> --
> Masami Hiramatsu <mhiramat@kernel.org>
--
Best Regards
Guo Ren
ML: https://lore.kernel.org/linux-csky/
next prev parent reply other threads:[~2021-06-09 15:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-09 10:50 [PATCH 0/5] kprobes: Bugfix and improvements Punit Agrawal
2021-06-09 10:50 ` [PATCH 1/5] kprobes: Do not use local variable when creating debugfs file Punit Agrawal
2021-06-09 14:35 ` Masami Hiramatsu
2021-06-10 23:31 ` Punit Agrawal
2021-06-09 10:50 ` [RFC PATCH 2/5] kprobes: Use helper to parse boolean input from userspace Punit Agrawal
2021-06-09 14:37 ` Masami Hiramatsu
2021-06-09 10:50 ` [RFC PATCH 3/5] kprobe: Simplify prepare_kprobe() by dropping redundant version Punit Agrawal
2021-06-09 14:42 ` Masami Hiramatsu
2021-06-09 10:50 ` [RFC PATCH 4/5] csky: ftrace: Drop duplicate implementation of arch_check_ftrace_location() Punit Agrawal
2021-06-09 12:33 ` Guo Ren
2021-06-09 14:29 ` Masami Hiramatsu
2021-06-09 15:47 ` Guo Ren [this message]
2021-06-10 0:07 ` Masami Hiramatsu
2021-06-09 10:50 ` [RFC PATCH 5/5] kprobes: Make arch_check_ftrace_location static Punit Agrawal
2021-06-10 0:37 ` Masami Hiramatsu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJF2gTTSFaexHqbZfHp2tMh-VbmRu+9sJPrWtKv14t6Vassv5A@mail.gmail.com \
--to=guoren@kernel.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=guoren@linux.alibaba.com \
--cc=linux-csky@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=naveen.n.rao@linux.ibm.com \
--cc=punitagrawal@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).