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]
Date:	Sun, 24 Jul 2011 20:07:13 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Srikar Dronamraju <srikar@...ux.vnet.ibm.com>
Cc:	Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...e.hu>,
	Steven Rostedt <rostedt@...dmis.org>,
	Linux-mm <linux-mm@...ck.org>,
	Arnaldo Carvalho de Melo <acme@...radead.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ananth N Mavinakayanahalli <ananth@...ibm.com>,
	Hugh Dickins <hughd@...gle.com>,
	Christoph Hellwig <hch@...radead.org>,
	Jonathan Corbet <corbet@....net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jim Keniston <jkenisto@...ux.vnet.ibm.com>,
	Roland McGrath <roland@...k.frob.com>,
	Andi Kleen <andi@...stfloor.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 3.0-rc2-tip 4/22]  4: Uprobes: register/unregister
	probes.

Hi Srikar,

I still hope some day I'll find the time to read the whole series ;)
Trying to continue from where I have stopped, and it seems that this
patch has a couple more problems.

On 06/07, Srikar Dronamraju wrote:
>
> A probe is specified by a file:offset.  While registering, a breakpoint
> is inserted for the first consumer, On subsequent probes, the consumer
> gets appended to the existing consumers. While unregistering a
> breakpoint is removed if the consumer happens to be the last consumer.
> All other unregisterations, the consumer is deleted from the list of
> consumers.
>
> Probe specifications are maintained in a rb tree. A probe specification
> is converted into a uprobe before store in a rb tree.  A uprobe can be
> shared by many consumers.

register/unregister logic looks racy...

Supose that uprobe U has a single consumer C and register_uprobe()
is called with the same inode/offset, while another thread does
unregister(U,C).

	- register() calls alloc_uprobe(), finds the entry in rb tree,
	  and increments U->ref. But this doesn't add the new consumer.

	- uregister() does del_consumer(), and removes the single
	  consumer C.

	  then it takes uprobes_mutex, sees uprobe->consumers == NULL
	  and calls delete_uprobe()->rb_erase()

	- register() continues, takes uprobes_mutex, re-inserts the
	  breakpoints, finds the new consumer and succeeds.

	  However, this uprobe is not in rb-tree, it was deleted
	  by unregister.



OTOH. Suppose we add the new uprobe. register()->alloc_uprobe() sets
new_uprobe->ref == 2. If something goes wrong after that, register()
does delete_uprobe() + put_uprobe(), new_uprobe->ref becomes 1 and
we leak this uprobe.

Oleg.

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