lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1295957741.28776.719.camel@laptop>
Date:	Tue, 25 Jan 2011 13:15:41 +0100
From:	Peter Zijlstra <peterz@...radead.org>
To:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc:	Ingo Molnar <mingo@...e.hu>, Steven Rostedt <rostedt@...dmis.org>,
	Linux-mm <linux-mm@...r.kernel.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Christoph Hellwig <hch@...radead.org>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Oleg Nesterov <oleg@...hat.com>,
	LKML <linux-kernel@...r.kernel.org>,
	SystemTap <systemtap@...rces.redhat.com>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Andi Kleen <andi@...stfloor.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
Subject: Re: [RFC] [PATCH 2.6.37-rc5-tip 8/20]  8: uprobes: mmap and fork
 hooks.

On Thu, 2010-12-16 at 15:28 +0530, Srikar Dronamraju wrote:
> +static void search_within_subtree(struct rb_node *n, struct inode *inode,
> +               struct list_head *tmp_list);
> +
> +static void add_to_temp_list(struct vm_area_struct *vma, struct inode *inode,
> +               struct list_head *tmp_list)
> +{
> +       struct uprobe *uprobe;
> +       struct rb_node *n;
> +       unsigned long flags;
> +
> +       n = uprobes_tree.rb_node;
> +       spin_lock_irqsave(&treelock, flags);
> +       while (n) {
> +               uprobe = rb_entry(n, struct uprobe, rb_node);
> +               if (match_inode(uprobe, inode, &n)) {
> +                       list_add(&uprobe->pending_list, tmp_list);
> +                       search_within_subtree(n, inode, tmp_list);
> +                       break;
> +               }
> +       }
> +       spin_unlock_irqrestore(&treelock, flags);
> +}
> +
> +static void __search_within_subtree(struct rb_node *p, struct inode *inode,
> +               struct list_head *tmp_list)
> +{
> +       struct uprobe *uprobe;
> +
> +       uprobe = rb_entry(p, struct uprobe, rb_node);
> +       if (match_inode(uprobe, inode, &p)) {
> +               list_add(&uprobe->pending_list, tmp_list);
> +               search_within_subtree(p, inode, tmp_list);
> +       }
> +
> +
> +}
> +
> +static void search_within_subtree(struct rb_node *n, struct inode *inode,
> +               struct list_head *tmp_list)
> +{
> +       struct rb_node *p;
> +
> +       if (p)
> +               __search_within_subtree(p, inode, tmp_list);
> +
> +       p = n->rb_right;
> +       if (p)
> +               __search_within_subtree(p, inode, tmp_list);
> +} 

Whee recursion FTW!, you just blew your kernel stack :-)

Since you sort inode first, offset second, I think you can simply look
for the first matching inode entry and simply rb_next() until you don't
match.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ