forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 477
Closed
Labels
unsoundThe possibility of UB in safe code.The possibility of UB in safe code.• libRelated to the `rust/` library.Related to the `rust/` library.
Description
Currently, there's a design hole which allows users to pass an unregistered lockdep key to a C function that expects a registered one: example. We can fix this by:
- Replace
&LockClassKey
withPin<&LockClassKey>
in all lock APIs to reflect that the lock keys need address stability to work. - Introduce pin initializer for
LockClassKey
, which registers the key at the initialization time. - Add pin drop function for
LockClassKey
, which unregisters the key. - Make sure
static_lock_class!()
still work by creating aPin<&'static LockClassKey>
from a static uninit variable (as long as it's static allocated, lockdep supports the uninitialized key).
Detailed discussions can be found: https://lore.kernel.org/rust-for-linux/2e3bc20e-ca91-45bb-9e35-586620e56d96@proton.me/
Metadata
Metadata
Assignees
Labels
unsoundThe possibility of UB in safe code.The possibility of UB in safe code.• libRelated to the `rust/` library.Related to the `rust/` library.