LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Masami Hiramatsu <mhiramat@redhat.com>
Cc: h-shimamoto@ct.jp.nec.com, ananth@in.ibm.com,
	laijs@cn.fujitsu.com, davem@davemloft.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kprobes: bugfix: try_module_get even if calling_mod is NULL
Date: Thu, 6 Nov 2008 17:00:23 -0800	[thread overview]
Message-ID: <20081106170023.d5349c42.akpm@linux-foundation.org> (raw)
In-Reply-To: <49123521.6020608@redhat.com>

On Wed, 05 Nov 2008 19:06:57 -0500
Masami Hiramatsu <mhiramat@redhat.com> wrote:

> Get probed module even if the caller is in the kernel core code.
> 
> Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
> ---
> 
> >> One question, off topic.
> >> If calling_mod is NULL, no try_module_get(), is that OK?
> >
> > Good question. Currently, kprobes is called only from kernel modules,
> > so calling_mod should be always !NULL.
> > However, it should be fixed, because the logic is not correct.
> 
> Thank you so much. So here is the additional bugfix patch.
> 
>  kernel/kprobes.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> Index: 2.6.28-rc3/kernel/kprobes.c
> ===================================================================
> --- 2.6.28-rc3.orig/kernel/kprobes.c
> +++ 2.6.28-rc3/kernel/kprobes.c
> @@ -634,7 +634,7 @@ static int __kprobes __register_kprobe(s
>  		 * avoid incrementing the module refcount, so as to allow
>  		 * unloading of self probing modules.
>  		 */
> -		if (calling_mod && calling_mod != probed_mod) {
> +		if (calling_mod != probed_mod) {
>  			if (unlikely(!try_module_get(probed_mod))) {
>  				preempt_enable();
>  				return -EINVAL;
> 

I do not understand this description "Get probed module even if the
caller is in the kernel core code".

What bug is being fixed here?  What is the kernel behaviour before and
after the patch?

Was the bug present in 2.6.27, 2.6.26 etc?  Or was it a post-2.6.28
regression?


  reply	other threads:[~2008-11-07  1:01 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-04  5:56 [PATCH] kprobes: disable preempt for module_text_address() Lai Jiangshan
2008-11-04 14:28 ` Ananth N Mavinakayanahalli
2008-11-05  0:53   ` Lai Jiangshan
2008-11-05  1:27 ` Masami Hiramatsu
2008-11-05  1:47   ` Lai Jiangshan
2008-11-05 19:30     ` Hiroshi Shimamoto
2008-11-05 21:40     ` Masami Hiramatsu
2008-11-05 22:46       ` Hiroshi Shimamoto
2008-11-05 23:07         ` Masami Hiramatsu
2008-11-06  0:06           ` [PATCH] kprobes: bugfix: try_module_get even if calling_mod is NULL Masami Hiramatsu
2008-11-07  1:00             ` Andrew Morton [this message]
2008-11-07  2:28               ` Masami Hiramatsu
2008-11-07  2:54                 ` Andrew Morton
2008-11-07  4:46                   ` Ananth N Mavinakayanahalli
2008-11-06  1:06       ` [PATCH] kprobes: disable preempt for module_text_address() Lai Jiangshan
2008-11-06 15:37         ` [PATCH] kprobes: disable preempt for module_text_address() and kernel_text_address() Masami Hiramatsu
2008-11-07  0:32           ` Lai Jiangshan

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=20081106170023.d5349c42.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=ananth@in.ibm.com \
    --cc=davem@davemloft.net \
    --cc=h-shimamoto@ct.jp.nec.com \
    --cc=laijs@cn.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhiramat@redhat.com \
    --subject='Re: [PATCH] kprobes: bugfix: try_module_get even if calling_mod is NULL' \
    /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

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).