All of lore.kernel.org
 help / color / mirror / Atom feed
From: Keshavamurthy Anil S <anil.s.keshavamurthy@intel.com>
To: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org, prasanna@in.ibm.com,
	anil.s.keshavamurthy@intel.com
Subject: Re: [PATCH] kprobes: fix race in aggregate kprobe registration
Date: Tue, 6 Dec 2005 13:18:24 -0800	[thread overview]
Message-ID: <20051206131823.A8726@unix-os.sc.intel.com> (raw)
In-Reply-To: <20051206051711.GA3206@in.ibm.com>; from ananth@in.ibm.com on Tue, Dec 06, 2005 at 10:47:11AM +0530

On Tue, Dec 06, 2005 at 10:47:11AM +0530, Ananth N Mavinakayanahalli wrote:
> From: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
> 
> When registering multiple kprobes at the same address, we leave a small
> window where the kprobe hlist will not contain a reference to the
> registered kprobe, leading to potentially, a system crash if the
> breakpoint is hit on another processor.
> 
> Patch below changes the order of hlist updation to make sure that there
> is always a reference to the kprobe at the location.

Hi Ananth,
	How do you like this patch? Here the old entry
will be replace with the new entry automically. 

Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>

 kernel/kprobes.c |    5 +----
 1 files changed, 1 insertion(+), 4 deletions(-)

Index: linux-2.6.15-rc5-mm1/kernel/kprobes.c
===================================================================
--- linux-2.6.15-rc5-mm1.orig/kernel/kprobes.c
+++ linux-2.6.15-rc5-mm1/kernel/kprobes.c
@@ -399,10 +399,7 @@ static inline void add_aggr_kprobe(struc
 	INIT_LIST_HEAD(&ap->list);
 	list_add_rcu(&p->list, &ap->list);
 
-	INIT_HLIST_NODE(&ap->hlist);
-	hlist_del_rcu(&p->hlist);
-	hlist_add_head_rcu(&ap->hlist,
-		&kprobe_table[hash_ptr(ap->addr, KPROBE_HASH_BITS)]);
+	hlist_replace_rcu(&p->hlist, &ap->hlist);
 }
 
 /*

  reply	other threads:[~2005-12-06 21:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-06  5:17 [PATCH] kprobes: fix race in aggregate kprobe registration Ananth N Mavinakayanahalli
2005-12-06 21:18 ` Keshavamurthy Anil S [this message]
2005-12-07  3:30   ` Ananth N Mavinakayanahalli
2005-12-07  9:54     ` Andrew Morton
2005-12-07 17:25 ` Keshavamurthy Anil S

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=20051206131823.A8726@unix-os.sc.intel.com \
    --to=anil.s.keshavamurthy@intel.com \
    --cc=akpm@osdl.org \
    --cc=ananth@in.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=prasanna@in.ibm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.