You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 with Pin<&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 a Pin<&'static LockClassKey> from a static uninit variable (as long as it's static allocated, lockdep supports the uninitialized key).
Reintroduce dynamically-allocated LockClassKeys such that they are
automatically (de)registered. Require that all usages of LockClassKeys
ensure that they are Pin'd.
Closes: Rust-for-Linux#1102
Suggested-by: Benno Lossin <[email protected]>
Suggested-by: Boqun Feng <[email protected]>
Signed-off-by: Mitchell Levy <[email protected]>
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:
&LockClassKey
withPin<&LockClassKey>
in all lock APIs to reflect that the lock keys need address stability to work.LockClassKey
, which registers the key at the initialization time.LockClassKey
, which unregisters the key.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/[email protected]/
The text was updated successfully, but these errors were encountered: