From: Ingo Molnar <mingo@kernel.org>
To: Jianyu Zhan <nasa4836@gmail.com>
Cc: ananth@in.ibm.com, anil.s.keshavamurthy@intel.com,
davem@davemloft.net, masami.hiramatsu.pt@hitachi.com,
rdunlap@infradead.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RESEND] kprobes: be more permissive when user specifies both symbol name and address
Date: Mon, 28 Jul 2014 12:51:56 +0200 [thread overview]
Message-ID: <20140728105156.GB14215@gmail.com> (raw)
In-Reply-To: <1403249659-4822-1-git-send-email-nasa4836@gmail.com>
* Jianyu Zhan <nasa4836@gmail.com> wrote:
> Hi, I found that this patch wasn't merged into mainline during this merge
> window(maybe it wasn't cooked in any tree), while it has been acked-by for
> a couple of days.
>
> Ingo, would you mind queueing this one? Thanks.
>
> -----<8-----
>
> Currently, if user specifies both symbol name and address, we just
> bail out.
>
> This might be too rude. This patch makes it give more tolerance.
> If both are specified, check address first, if the symbol found
> does not match the one user specify, print a waring. If not found,
> return -ENOENT, because some symbols might have muplitple instances,
> we don't bother to check symbol name.
>
> Acked-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
> Signed-off-by: Jianyu Zhan <nasa4836@gmail.com>
> ---
> Documentation/kprobes.txt | 4 +++-
> kernel/kprobes.c | 32 +++++++++++++++++++++++++++++---
> 2 files changed, 32 insertions(+), 4 deletions(-)
>
> diff --git a/Documentation/kprobes.txt b/Documentation/kprobes.txt
> index 4bbeca8..49af14e 100644
> --- a/Documentation/kprobes.txt
> +++ b/Documentation/kprobes.txt
> @@ -358,7 +358,9 @@ to install a probepoint is known. This field is used to calculate the
> probepoint.
>
> 3. Specify either the kprobe "symbol_name" OR the "addr". If both are
> -specified, kprobe registration will fail with -EINVAL.
> +specified, only check "addr", because some symbols might have muplitple
> +instances. If neither is specified, kprobe registration will fail
> +with -EINVAL.
>
> 4. With CISC architectures (such as i386 and x86_64), the kprobes code
> does not validate if the kprobe.addr is at an instruction boundary.
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 3214289..81d891b 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -1358,15 +1358,41 @@ static bool within_kprobe_blacklist(unsigned long addr)
> static kprobe_opcode_t *kprobe_addr(struct kprobe *p)
> {
> kprobe_opcode_t *addr = p->addr;
> + char namebuf[KSYM_NAME_LEN];
> + const char *sym_name = NULL;
> + unsigned long offset;
>
> - if ((p->symbol_name && p->addr) ||
> - (!p->symbol_name && !p->addr))
> + if (!p->symbol_name && !p->addr)
> goto invalid;
>
> - if (p->symbol_name) {
> + /*
> + * Some symbols might have muplitple instances,
s/multiple
> + * so if both specified, only check address.
s/:
* so if both are specified, only check the address.
> + } else {
> + /*
> + * Only address case.
> + * Since we later will do sanity check of the
'will do a sanity check' or 'will do sanity checking'
Thanks,
Ingo
next prev parent reply other threads:[~2014-07-28 10:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-20 7:34 [PATCH RESEND] kprobes: be more permissive when user specifies both symbol name and address Jianyu Zhan
2014-07-28 9:21 ` Masami Hiramatsu
2014-07-28 10:51 ` Ingo Molnar [this message]
2014-07-29 12:47 ` Jianyu Zhan
2014-07-29 12:50 ` Jianyu Zhan
2014-07-29 23:56 ` Namhyung Kim
2014-07-30 1:15 ` 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=20140728105156.GB14215@gmail.com \
--to=mingo@kernel.org \
--cc=ananth@in.ibm.com \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=masami.hiramatsu.pt@hitachi.com \
--cc=nasa4836@gmail.com \
--cc=rdunlap@infradead.org \
/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