Take ARCH_KMALLOC_MINALIGN into account for build-time XArray check
Status from this message: Applied to alloc-next, thanks!
Get series with b4
b4 am [email protected] change-id 20250715-align-min-allocator-b31aee53cbdaVersions newest first
- v2 Latest2 patches 13 repliesApplied
- v12 patches 8 repliesSuperseded
Changes in v2 from the cover letter
- Reword guarantee on const MIN_ALIGN.
- Change formatting of if/else in kbox.rs.
- Rebase on v6.17-rc1.
- Link to v1: https://lore.kernel.org/r/[email protected]
Patches in v2 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | rust: alloc: specify the minimum alignment of each allocatorrust/ rust/ | +16 | 6 replies | |
| 2/2 | rust: alloc: take the allocator into account for FOREIGN_ALIGNrust/ rust/ | +12 | 0 replies |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.
| Patch | Benno Lossin | Andreas Hindborg | Liam R. Howlett |
|---|---|---|---|
| Series | R-b | A-b | |
| 1/2 | R-b | ||
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.
Cover letter [PATCH v2 0/2] Take ARCH_KMALLOC_MINALIGN into account for build-time XArray check
The Rust bindings for XArray include a build-time check to ensure that you can only use the XArray with pointers that are 4-byte aligned. Because of that, there is currently a build failure if you attempt to create an XArray<KBox<T>> where T is a 1-byte or 2-byte aligned type. However, this error is incorrect as KBox<_> is guaranteed to be a pointer that comes from kmalloc, and kmalloc always produces pointers that are at least 4-byte aligned.
To fix this, we augment the compile-time logic that computes the alignment of KBox<_> to take the minimum alignment of its allocator into account.
Intended to land through alloc-next under the RUST [ALLOC] entry.
---
Changes in v2:
- Reword guarantee on const MIN_ALIGN.
- Change formatting of if/else in kbox.rs.
- Rebase on v6.17-rc1.
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Alice Ryhl (2):
rust: alloc: specify the minimum alignment of each allocator
rust: alloc: take the allocator into account for FOREIGN_ALIGN
rust/kernel/alloc.rs | 8 ++++++++ rust/kernel/alloc/allocator.rs | 8 ++++++++ rust/kernel/alloc/kbox.rs | 13 +++++++++---- rust/kernel/sync/arc.rs | 6 +++--- 4 files changed, 28 insertions(+), 7 deletions(-)
---
base-commit: 062b3e4a1f880f104a8d4b90b767788786aa7b78
change-id: 20250715-align-min-allocator-b31aee53cbda
Best regards,
Signature · 1 line
Alice Ryhl <[email protected]>