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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aB3DbelD08I1hL3U@google.com>
Date: Fri, 9 May 2025 08:57:17 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: Tiffany Yang <ynaffit@...gle.com>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>, 
	"Arve Hjønnevåg" <arve@...roid.com>, Todd Kjos <tkjos@...roid.com>, Martijn Coenen <maco@...roid.com>, 
	Joel Fernandes <joel@...lfernandes.org>, Christian Brauner <brauner@...nel.org>, 
	Carlos Llamas <cmllamas@...gle.com>, Suren Baghdasaryan <surenb@...gle.com>, linux-kernel@...r.kernel.org, 
	kernel-team@...roid.com
Subject: Re: [PATCH v3 1/2] binder: Refactor binder_node print synchronization

On Thu, May 08, 2025 at 07:01:38PM +0000, Tiffany Yang wrote:
> Alice Ryhl <aliceryhl@...gle.com> writes:
> > I don't buy this logic. Imagine the following scenario:
> >
> > 1. print_binder_proc is called, and we loop over proc->nodes.
> > 2. We call binder_inner_proc_unlock(node->proc).
> > 3. On another thread, binder_deferred_release() is called.
> > 4. The node is removed from proc->nodes and node->proc is set to NULL.
> > 5. Back in print_next_binder_node_ilocked(), we now call
> >    spin_lock(&binder_dead_nodes_lock) and return.
> > 6. In print_binder_proc(), we think that we hold the proc lock, but
> >    actually we hold the dead nodes lock instead. BOOM.
> >
> > What happens with the current code is that print_binder_proc() takes the
> > proc lock again after the node was removed from proc->nodes, and then it
> > exits the loop because rb_next(n) returns NULL when called on a node not
> > in any rb-tree.
> >
> > Alice
> 
> 
> Thanks for catching this!! I think this race could be solved by passing
> "proc" in as a parameter (NULL if iterating over the dead_nodes_list),
> and locking/unlocking based on that instead of node->proc. WDYT?

I believe that would work.

Alice

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ