linux-yocto/drivers/android
Alice Ryhl 30a98c97f7 rust_binder: remove spin_lock() in rust_shrink_free_page()
commit 361e0ff456a8daf9753c18030533256e4133ce7a upstream.

When forward-porting Rust Binder to 6.18, I neglected to take commit
fb56fdf8b9 ("mm/list_lru: split the lock to per-cgroup scope") into
account, and apparently I did not end up running the shrinker callback
when I sanity tested the driver before submission. This leads to crashes
like the following:

	============================================
	WARNING: possible recursive locking detected
	6.18.0-mainline-maybe-dirty #1 Tainted: G          IO
	--------------------------------------------
	kswapd0/68 is trying to acquire lock:
	ffff956000fa18b0 (&l->lock){+.+.}-{2:2}, at: lock_list_lru_of_memcg+0x128/0x230

	but task is already holding lock:
	ffff956000fa18b0 (&l->lock){+.+.}-{2:2}, at: rust_helper_spin_lock+0xd/0x20

	other info that might help us debug this:
	 Possible unsafe locking scenario:

	       CPU0
	       ----
	  lock(&l->lock);
	  lock(&l->lock);

	 *** DEADLOCK ***

	 May be due to missing lock nesting notation

	3 locks held by kswapd0/68:
	 #0: ffffffff90d2e260 (fs_reclaim){+.+.}-{0:0}, at: kswapd+0x597/0x1160
	 #1: ffff956000fa18b0 (&l->lock){+.+.}-{2:2}, at: rust_helper_spin_lock+0xd/0x20
	 #2: ffffffff90cf3680 (rcu_read_lock){....}-{1:2}, at: lock_list_lru_of_memcg+0x2d/0x230

To fix this, remove the spin_lock() call from rust_shrink_free_page().

Cc: stable <stable@kernel.org>
Fixes: eafedbc7c0 ("rust_binder: add Rust Binder driver")
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20251202-binder-shrink-unspin-v1-1-263efb9ad625@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-01-17 16:35:11 +01:00
..
binder rust_binder: remove spin_lock() in rust_shrink_free_page() 2026-01-17 16:35:11 +01:00
tests binder: Use seq_buf in binder_alloc kunit tests 2025-07-24 11:42:43 +02:00
binder_alloc.c binder: Convert binder_alloc selftests to KUnit 2025-07-16 14:11:59 +02:00
binder_alloc.h binder: Convert binder_alloc selftests to KUnit 2025-07-16 14:11:59 +02:00
binder_internal.h binder: add t->is_async and t->is_reply 2025-08-19 12:53:01 +02:00
binder_netlink.c binder: introduce transaction reports via netlink 2025-08-19 12:53:01 +02:00
binder_netlink.h binder: introduce transaction reports via netlink 2025-08-19 12:53:01 +02:00
binder_trace.h binder: add tracepoint for netlink reports 2025-08-19 12:53:02 +02:00
binder.c binder: remove "invalid inc weak" check 2025-10-22 08:04:15 +02:00
binderfs.c binder: add transaction_report feature entry 2025-08-19 12:53:01 +02:00
dbitmap.h binder: fix double-free in dbitmap 2025-09-18 17:20:00 +02:00
Kconfig rust_binder: add Rust Binder driver 2025-09-19 09:40:46 +02:00
Makefile rust_binder: add Rust Binder driver 2025-09-19 09:40:46 +02:00