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:
|
||
|---|---|---|
| .. | ||
| binder | ||
| tests | ||
| Kconfig | ||
| Makefile | ||
| binder.c | ||
| binder_alloc.c | ||
| binder_alloc.h | ||
| binder_internal.h | ||
| binder_netlink.c | ||
| binder_netlink.h | ||
| binder_trace.h | ||
| binderfs.c | ||
| dbitmap.h | ||