mirror of https://github.com/torvalds/linux.git
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:
|
||
|---|---|---|
| .. | ||
| node | ||
| range_alloc | ||
| Makefile | ||
| allocation.rs | ||
| context.rs | ||
| deferred_close.rs | ||
| defs.rs | ||
| error.rs | ||
| freeze.rs | ||
| node.rs | ||
| page_range.rs | ||
| page_range_helper.c | ||
| page_range_helper.h | ||
| process.rs | ||
| rust_binder.h | ||
| rust_binder_events.c | ||
| rust_binder_events.h | ||
| rust_binder_internal.h | ||
| rust_binder_main.rs | ||
| rust_binderfs.c | ||
| stats.rs | ||
| thread.rs | ||
| trace.rs | ||
| transaction.rs | ||