milos-linux/rust
Shivam Kalra 880fa3a1e5 rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds
Commit 47ac2a4b5c ("rust: kvec: implement shrink_to for KVVec")
introduced a call to bindings::is_vmalloc_addr(). However, this
fails to compile on architectures where CONFIG_MMU is disabled,
resulting in the following build error:

    error[E0425]: cannot find function `is_vmalloc_addr` in crate `bindings`
       --> rust/kernel/alloc/kvec.rs:781:32
        |
    781 |         if !unsafe { bindings::is_vmalloc_addr(self.ptr.as_ptr().cast()) } {
        |                                ^^^^^^^^^^^^^^^ not found in `bindings`

When CONFIG_MMU is not set, is_vmalloc_addr() is defined as a
static inline function in <linux/mm.h> that unconditionally
returns false. Because bindgen skips static inline functions
when generating bindings, the symbol is completely missing from
the Rust bindings crate.

Fix this by providing a C helper wrapper, rust_helper_is_vmalloc_addr(),
in rust/helpers/vmalloc.c. This ensures the function is reliably
exposed to Rust regardless of the MMU configuration. On NOMMU builds,
this allows KVVec::shrink_to() to successfully compile and correctly
route all allocations through the kmalloc realloc path.

Fixes: 47ac2a4b5c ("rust: kvec: implement shrink_to for KVVec")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202605220811.LRplxeBR-lkp@intel.com/
Signed-off-by: Shivam Kalra <shivamkalra98@zohomail.in>
Reviewed-by: Danilo Krummrich <dakr@kernel.org>
Reviewed-by: Alice Ryhl <aliceryhl@google.com>
Link: https://patch.msgid.link/20260523-is-vmalloc-addr-build-fix-v1-1-73c919440c41@zohomail.in
[ Pasted exact compiler output and expanded it. - Miguel ]
Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
2026-05-27 20:01:04 +02:00
..
bindings drm for v7.1-rc1 2026-04-15 08:45:00 -07:00
helpers rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds 2026-05-27 20:01:04 +02:00
kernel rust: drm: fix unsound initialization in drm::Device::new 2026-05-03 14:04:57 +02:00
macros rust: macros: simplify code using feature(extract_if) 2026-04-07 10:00:24 +02:00
pin-init rust: pin-init: fix incorrect accessor reference lifetime 2026-04-30 22:43:32 +02:00
proc-macro2 rust: proc-macro2: rebuild if the version text changes 2026-01-23 10:44:27 +01:00
quote
syn rust: syn: add README.md 2025-11-24 17:15:47 +01:00
uapi rust: declare cfi_encoding for lru_status 2026-04-07 10:00:25 +02:00
.gitignore
.kunitconfig
bindgen_parameters rust: declare cfi_encoding for lru_status 2026-04-07 10:00:25 +02:00
build_error.rs
compiler_builtins.rs
exports.c kbuild: rust: provide an option to inline C helpers into Rust 2026-03-30 02:03:52 +02:00
ffi.rs
Makefile rust: arch: um: Fix building 32-bit UML with GCC 2026-04-30 22:40:57 +02:00