- 
                Notifications
    You must be signed in to change notification settings 
- Fork 475
Description
Note: there is the "A-rust-for-linux" label in the rust repository: https://github.com/rust-lang/rust/labels/A-rust-for-linux.
Features that we would like to see
Required (we almost certainly want them)
- 
Disabling atomics (i.e. only allowing the LKMM ones introduced in v6.18 in the kernelcrate).- Part of the "modularization of core" topic.
 
- Part of the "modularization of 
- 
Guaranteeing TypeId's size is at most 16 bytes.
Nice to have (not critical, we could workaround if needed, etc.)
- 
Disabling 128-bit features. - Part of the "modularization of core" topic.
- PR: Add cfg(no_128_bit) to core: removes u128/i128 formatting rust-lang/rust#103126.
- PR: WIP/ POC Add no_iu128_fmtconfig to disable 128 bit integer formatting. rust-lang/rust#136385.
 
- Part of the "modularization of 
- 
Disabling floating-point features. - Part of the "modularization of core" topic.
- Currently we provide weak symbols that panics, but generally we should not even compile floating point support (in the kernel, very little code needs it, and it is compiled differently in the C side). Ideally, we would have a compiler flag to disable all that where not needed (possibly even not accepting code referring to f32etc.).Maybe we should add a check, perhaps by compiling against softfp and link against compile-rt with hardfp to see if no symbols are unresolved? 
- Cc: @nbdd0121.
- PR (a cfgto disable formatting of floating point): core: add unstable no_fp_fmt_parse to disable float formatting code rust-lang/rust#86048.
 
- Part of the "modularization of 
- 
Disabling Unicode features / a way to use external tables. - Part of the "modularization of core" topic.
 
- Part of the "modularization of 
- 
Clarify invariants of the Layouttype.- i.e. lift requirements to the type from the constructors / how does one connect Layoutto "a layout suitable to an allocated object"? Is it library / language UB? (currently it appears to be the former).
- After [ptr] Document maximum allocation size rust-lang/rust#116675, a reference could be added to that from Layouttype documentation.
- Rust Zulip: https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/Document.20.60Layout.60.20Type.20Invariant.3F/near/412607198.
- From: discussion in Rust for Linux Zulip between Valentin, Benno and Miguel.
- Related issue in UCG: Where to document allocation size upper bound? rust-lang/unsafe-code-guidelines#465.
- Related PR: Enforce that layout size fits in isize in Layout rust-lang/rust#95295.
 
- i.e. lift requirements to the type from the constructors / how does one connect 
- 
c_stringify!,c_concat!,c_file!macros.- Instead of having to provide a c_str!macro to then doc_str!(stringify!(...))orc_str!(concat!(...)).
- Lore: https://lore.kernel.org/rust-for-linux/CANiq72nbbtNp4vGGHkXVSgSW+WU=5Z9uGRO_LLg7+ezTqrZ_tQ@mail.gmail.com/
- Rust Zulip: https://rust-lang.zulipchat.com/#narrow/stream/404510-wg-macros/topic/May.20we.20need.20a.20.60c_stringify!.60.20and.20.60c_concat!.60.20macros.3F/near/466691443.
- Cc: @vincenzopalazzo @y86-dev.
- It could prevent mistakes where one assumes it is nul-terminated, perhaps disallowing the usual one in Clippy: https://lore.kernel.org/rust-for-linux/20241016035214.2229-8-fujita.tomonori@gmail.com/#iZ31rust:kernel:io:poll.rs.
 
- Instead of having to provide a 
- 
Clarify addr_of!documentation about whether it creates read-only pointers or not.
- 
Moving towards core::ffi::CStr(fromkernel::str::CStr).- Rust for Linux Issue: Replace kernel::str::CStrbycore::ffi::CStr#1075.
- PR: Implement Deref<Target=ByteStr> for CStr rust-lang/rust#138498.
- impl Display for CStrACP:- impl Display for CStrrust-lang/libs-team#550.
- impl Display for CStrTracking Issue: Tracking Issue for- CStr::displayrust-lang/rust#139984.
- impl Display for CStrPR: add- CStr::displayrust-lang/rust#139994.
- ByteStrTracking Issue: Tracking Issue for ByteStr/ByteString rust-lang/rust#134915.
- Related PR: Improve the documentation of DisplayandFromStr, and their interactions rust-lang/rust#136687.
- Lore ("rust: replace kernel::str::CStr w/ core::ffi::CStr"): https://lore.kernel.org/rust-for-linux/20250317-cstr-core-v9-0-51d6cc522f62@gmail.com/.
- Lore (Gary's suggestion): https://lore.kernel.org/all/20250221142816.0c015e9f@eugeo/.
 
- Rust for Linux Issue: Replace 
- 
container_of!in the standard library.- Currently we use our own implementation.
 
- 
feature(int_lowest_highest_one), i.e.{highest,lowest_one}({first,last}_set_bit) for integer types.- Tracking Issue: Tracking Issue for int_lowest_highest_onerust-lang/rust#145203.
- ACP (API Change Proposal): first_set_bitandlast_set_bitfor integer types rust-lang/libs-team#631.
- Lore: https://lore.kernel.org/rust-for-linux/DAREXAUV51B6.7X7TPOJKK249@nvidia.com/.
 
- Tracking Issue: Tracking Issue for 
Low priority (we will likely not use them in the end)
-  Generic atomics.
- We are considering whether to use a generic API for our atomics, thus we will be watching any progress on the coreones.
- Issue: Tracking Issue for generic Atomicrust-lang/rust#130539.
- ACP (API Change Proposal): ACP: Generic Atomic<T>rust-lang/libs-team#443.
- Initial PR: Create Atomic<T>type alias rust-lang/rust#130543.
- PR:  Create Atomic<T>type alias (rebase) rust-lang/rust#136316 (1.88).
- LPC Rust MC topic: https://lpc.events/event/18/contributions/1788/
- Cc: @fbq.
 
- We are considering whether to use a generic API for our atomics, thus we will be watching any progress on the 
Done (stabilized, fixed, not needed anymore, etc.)
- 
Ensure no_fp_fmt_parsebuilds are warning-free.
- 
Ensure no_global_oom_handlingbuilds are warning-free.
- 
C string equivalents (nul-terminated) for core::panic::Location(or a flag to ensure there is a\0after thestrs).- Moved to the main list: feature(location_file_nul).
- Tracking Issue: Tracking Issue for NUL-terminated file names with #[track_caller]rust-lang/rust#141727.
- For the macros like file!(), it is fine, since we can easily transform those withc_str!(which we already do), so it is a nice to have (see the related item below).
- Lore: https://lore.kernel.org/rust-for-linux/CAH5fLgjk5koTwMOcdsnQjTVWQehjCDPoD2M3KboGZsxigKdMfA@mail.gmail.com/.
- Rust Zulip: https://rust-lang.zulipchat.com/#narrow/stream/425075-rust-for-linux/topic/Caller.20location.20with.20nul-terminated.20filename/near/477164522.
- ACP: ACP: Add nul-terminated version of core::panic::Location::filerust-lang/libs-team#466 (accepted).
- PR: Add Location::file_with_nul rust-lang/rust#135054 (1.89).
- PR: Add unstable option to nul-terminate location strings rust-lang/rust#135240.
- PR: Add nul-terminated filename for #[track_caller] rust-lang/rust#131828.
- PR: Null terminate core::panic::Locationfile strings rust-lang/rust#117431.
 
- Moved to the main list: 
Bugs that we would like to see fixed
Required (we almost certainly want them)
Nice to have (probably not critical, we could workaround if needed, etc.)
Low priority (we will likely not use them in the end)
Done (stabilized, fixed, or not needed anymore, etc.)
- 
Fix warning when libcore is compiled with no_fp_fmt_parse rust-lang/rust#105434. 
- 
Fix no_global_oom_handlingbuild.
- 
Inline floating-point methods to avoid requiring intrinsics. - midpoint,- next_up,- next_downare not marked as- #[inline], which makes them appear under- -Osarm64, see Zulip: https://rust-for-linux.zulipchat.com/#narrow/stream/288089-General/topic/v6.2E11-rc1.20doesn't.20build.20for.20arm64/near/455637364.
- PR: Mark {f32,f64}::{next_up,next_down,midpoint}inline rust-lang/rust#128749.
 
- 
CFI failure on core::fmt::write()when FineIBT is enabled.- Issue: CFI: core and std have explict CFI violations rust-lang/rust#115199.
- PR (point 2 of the issue above): cfi: do not transmute function pointers in formatting code rust-lang/rust#139632 (1.88).
- PR (previous approach): cfi: Store type erasure witness for Argument rust-lang/rust#115954.
- Patch to restrict FineIBT with Rust: https://lore.kernel.org/rust-for-linux/20250410115420.366349-1-panikiel@google.com/.