2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/rust/kernel/alloc
Andreas Hindborg 12717ebeff rust: types: add FOREIGN_ALIGN to ForeignOwnable
The current implementation of `ForeignOwnable` is leaking the type of the
opaque pointer to consumers of the API. This allows consumers of the opaque
pointer to rely on the information that can be extracted from the pointer
type.

To prevent this, change the API to the version suggested by Maira
Canal (link below): Remove `ForeignOwnable::PointedTo` in favor of a
constant, which specifies the alignment of the pointers returned by
`into_foreign`.

With this change, `ArcInner` no longer needs `pub` visibility, so change it
to private.

Suggested-by: Alice Ryhl <aliceryhl@google.com>
Suggested-by: Maíra Canal <mcanal@igalia.com>
Link: https://lore.kernel.org/r/20240309235927.168915-3-mcanal@igalia.com
Acked-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Benno Lossin <lossin@kernel.org>
Signed-off-by: Andreas Hindborg <a.hindborg@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20250612-pointed-to-v3-1-b009006d86a1@kernel.org
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2025-07-14 23:55:24 +02:00
..
kvec rust: alloc: add Vec::insert_within_capacity 2025-05-07 18:40:45 +02:00
allocator_test.rs rust: enable clippy::ptr_as_ptr lint 2025-06-22 23:08:42 +02:00
allocator.rs rust: alloc: make ReallocFunc::call inline 2025-03-06 20:49:06 +01:00
kbox.rs rust: types: add FOREIGN_ALIGN to ForeignOwnable 2025-07-14 23:55:24 +02:00
kvec.rs rust: enable clippy::ptr_as_ptr lint 2025-06-22 23:08:42 +02:00
layout.rs rust: alloc: add doctest for ArrayLayout::new() 2025-01-13 23:45:30 +01:00