linux/drivers/android/binder
Alice Ryhl ec327abae5 rust_binder: use AssertSync for BINDER_VM_OPS
When declaring an immutable global variable in Rust, the compiler checks
that it looks thread safe, because it is generally safe to access said
global variable. When using C bindings types for these globals, we don't
really want this check, because it is conservative and assumes pointers
are not thread safe.

In the case of BINDER_VM_OPS, this is a challenge when combined with the
patch 'userfaultfd: introduce vm_uffd_ops' [1], which introduces a
pointer field to vm_operations_struct. It previously only held function
pointers, which are considered thread safe.

Rust Binder should not be assuming that vm_operations_struct contains no
pointer fields, so to fix this, use AssertSync (which Rust Binder has
already declared for another similar global of type struct
file_operations with the same problem). This ensures that even if
another commit adds a pointer field to vm_operations_struct, this does
not cause problems.

Fixes: 8ef2c15aea ("rust_binder: check ownership before using vma")
Cc: stable <stable@kernel.org>
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202603121235.tpnRxFKO-lkp@intel.com/
Link: https://lore.kernel.org/r/20260306171815.3160826-8-rppt@kernel.org [1]
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
Link: https://patch.msgid.link/20260314111951.4139029-1-aliceryhl@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-03-31 14:58:56 +02:00
..
node
range_alloc rust_binder: fix oneway spam detection 2026-02-26 21:31:50 -08:00
Makefile
allocation.rs
context.rs rust_binder: fix needless borrow in context.rs 2026-02-03 12:58:29 +01:00
deferred_close.rs
defs.rs
error.rs rust_binder: use `kernel::fmt` 2025-10-20 04:04:23 +02:00
freeze.rs Rust changes for v6.19 2025-12-03 14:16:49 -08:00
node.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
page_range.rs rust_binder: use AssertSync for BINDER_VM_OPS 2026-03-31 14:58:56 +02:00
page_range_helper.c
page_range_helper.h
process.rs rust_binder: call set_notification_done() without proc lock 2026-02-26 21:33:03 -08:00
rust_binder.h rust_binder: return p from rust_binder_transaction_target_node() 2026-02-03 13:10:07 +01:00
rust_binder_events.c
rust_binder_events.h rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
rust_binder_internal.h
rust_binder_main.rs rust_binder: use AssertSync for BINDER_VM_OPS 2026-03-31 14:58:56 +02:00
rust_binderfs.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
stats.rs rust_binder: Switch to kernel::sync atomic primitives 2026-01-09 19:01:41 +08:00
thread.rs rust_binder: avoid reading the written value in offsets array 2026-02-26 21:32:59 -08:00
trace.rs rust_binder: add binder_transaction tracepoint 2025-12-29 12:14:52 +01:00
transaction.rs Char/Misc/IIO driver changes for 7.0-rc1 2026-02-17 09:11:04 -08:00