stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
To: Prashanth Nageshappa <prashanth@linux.vnet.ibm.com>
Cc: linux-kernel@vger.kernel.org, ananth@in.ibm.com,
	akpm@linux-foundation.org, jbaron@redhat.com,
	rostedt@goodmis.org, srikar@linux.vnet.ibm.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] Return proper error code from register_kprobe()
Date: Tue, 14 Feb 2012 21:36:52 +0900	[thread overview]
Message-ID: <4F3A5564.1080607@hitachi.com> (raw)
In-Reply-To: <4F3A3D30.5010506@linux.vnet.ibm.com>

(2012/02/14 19:53), Prashanth Nageshappa wrote:
> register_kprobe() aborts if the address of the new request falls in a prohibited
> area (such as ftrace pouch, __kprobes annotated functions, non-kernel text
> addresses, jump label text). We however don't return the right error on this
> abort, resulting in incorrect adding/reporting of kprobes (Ex: 'perf probe
> do_fork+18' or 'perf probe mcount')

OK, I see.

> 
> This patch fixes it by returning -EINVAL upon failure.
> 
> Signed-off-by: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> Signed-off-by: Prashanth K Nageshappa<prashanth@linux.vnet.ibm.com>

However, I can't agree with this change :(, because this
ignores possibilities of -ENOENT error code in other error
paths.

What I'm expecting is, setup an error code where the error
occurs, as below;

        jump_label_lock();
        preempt_disable();
        if (!kernel_text_address((unsigned long) p->addr) ||
            in_kprobes_functions((unsigned long) p->addr) ||
            ftrace_text_reserved(p->addr, p->addr) ||
-           jump_label_text_reserved(p->addr, p->addr))
+           jump_label_text_reserved(p->addr, p->addr)) {
+		ret = -EINVAL;
                goto fail_with_jump_label;
+	}

IMHO, we should change the label name too...

Thank you,

-- 
Masami HIRAMATSU
Software Platform Research Dept. Linux Technology Center
Hitachi, Ltd., Yokohama Research Laboratory
E-mail: masami.hiramatsu.pt@hitachi.com

           reply	other threads:[~2012-02-14 12:36 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <4F3A3D30.5010506@linux.vnet.ibm.com>]

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=4F3A5564.1080607@hitachi.com \
    --to=masami.hiramatsu.pt@hitachi.com \
    --cc=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=jbaron@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prashanth@linux.vnet.ibm.com \
    --cc=rostedt@goodmis.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).