milos-linux/rust/helpers
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
..
atomic.c rust: helpers: Move #define __rust_helper out of atomic.c 2026-01-09 19:01:42 +08:00
atomic_ext.c rust: sync: atomic: Add Atomic<*{mut,const} T> support 2026-03-08 11:06:49 +01:00
auxiliary.c rust: auxiliary: add __rust_helper to helpers 2025-12-15 22:19:53 +01:00
barrier.c rust: barrier: Add __rust_helper to helpers 2026-01-09 19:01:41 +08:00
binder.c rust: binder: add __rust_helper to helpers 2025-12-29 12:10:47 +01:00
bitmap.c rust: bitmap: add __rust_helper to helpers 2026-01-06 12:14:10 -05:00
bitops.c bitmap updates for v6.20 2026-02-10 11:39:45 -08:00
blk.c rust: blk: Add __rust_helper to helpers 2026-01-09 19:01:41 +08:00
bug.c rust: bug: add __rust_helper to helpers 2026-01-26 03:48:25 +01:00
build_assert.c
build_bug.c rust: err: add __rust_helper to helpers 2026-01-26 03:49:04 +01:00
clk.c rust: clk: add __rust_helper to helpers 2026-03-10 11:29:00 +01:00
completion.c rust: completion: Add __rust_helper to helpers 2026-01-09 19:01:41 +08:00
cpu.c rust: cpu: Add __rust_helper to helpers 2026-01-09 19:01:41 +08:00
cpufreq.c rust: cpufreq: add __rust_helper to helpers 2026-01-27 11:21:22 +05:30
cpumask.c rust: cpumask: add __rust_helper to helpers 2026-01-06 12:14:10 -05:00
cred.c rust: cred: add __rust_helper to helpers 2026-01-06 20:30:09 -05:00
device.c rust: device: add device name method 2026-03-24 23:51:23 +01:00
dma-resv.c rust: helpers: Add bindings/wrappers for dma_resv_lock 2026-03-27 20:46:56 +01:00
dma.c rust: dma: add missing __rust_helper annotations 2026-02-06 20:19:09 +01:00
drm.c rust: drm: gem: shmem: Add DRM shmem helper abstraction 2026-03-27 21:38:40 +01:00
err.c rust: err: add __rust_helper to helpers 2026-01-26 03:49:04 +01:00
fs.c rust: fs: add __rust_helper to helpers 2025-12-15 14:13:03 +01:00
gpu.c rust: gpu: Add GPU buddy allocator bindings 2026-03-23 21:41:47 +01:00
helpers.c drm for v7.1-rc1 2026-04-15 08:45:00 -07:00
io.c rust: io: add __rust_helper to helpers 2025-12-15 22:26:10 +01:00
irq.c rust: irq: add __rust_helper to helpers 2025-12-15 22:26:10 +01:00
jump_label.c rust: jump_label: add __rust_helper to helpers 2026-03-10 11:29:16 +01:00
kunit.c rust: kunit: add __rust_helper to helpers 2026-01-05 15:32:03 -07:00
list.c rust: interop: Add list module for C linked list interface 2026-03-23 20:29:28 +01:00
maple_tree.c rust: maple_tree: add __rust_helper to helpers 2026-01-26 03:49:09 +01:00
mm.c rust: mm: add __rust_helper to helpers 2026-01-26 03:49:56 +01:00
mutex.c rust: sync: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
of.c rust: of: add __rust_helper to helpers 2026-01-26 03:50:21 +01:00
page.c rust: mm: add __rust_helper to helpers 2026-01-26 03:49:56 +01:00
pci.c rust: pci: add __rust_helper to helpers 2025-12-15 22:39:11 +01:00
pid_namespace.c rust: pid_namespace: add __rust_helper to helpers 2025-12-15 14:13:03 +01:00
platform.c rust: platform: add __rust_helper to helpers 2025-12-15 22:39:42 +01:00
poll.c rust: poll: add __rust_helper to helpers 2025-12-15 14:13:04 +01:00
processor.c rust: processor: Add __rust_helper to helpers 2026-01-09 19:01:41 +08:00
property.c rust: property: add __rust_helper to helpers 2025-12-15 22:39:42 +01:00
pwm.c rust: pwm: Add __rust_helper to helpers 2026-01-20 18:52:43 +01:00
rbtree.c rust: rbtree: add __rust_helper to helpers 2026-01-26 03:50:41 +01:00
rcu.c rust: rcu: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
refcount.c rust: refcount: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
regulator.c rust: regulator: add __rust_helper to helpers 2025-12-14 19:37:55 +09:00
scatterlist.c rust: scatterlist: add __rust_helper to helpers 2025-12-15 22:39:42 +01:00
security.c rust: security: add __rust_helper to helpers 2026-01-06 20:30:09 -05:00
signal.c rust: task: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
slab.c rust: slab: add __rust_helper to helpers 2026-01-26 03:50:50 +01:00
spinlock.c rust: sync: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
sync.c rust: sync: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
task.c rust: task: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
time.c rust: time: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
uaccess.c rust: uaccess: add __rust_helper to helpers 2026-01-26 03:51:16 +01:00
usb.c rust: usb: add __rust_helper to helpers 2026-01-07 16:12:15 +01:00
vmalloc.c rust: helpers: add is_vmalloc_addr wrapper for NOMMU builds 2026-05-27 20:01:04 +02:00
wait.c rust: wait: Add __rust_helper to helpers 2026-01-09 19:01:42 +08:00
workqueue.c rust: workqueue: add __rust_helper to helpers 2026-01-26 03:51:31 +01:00
xarray.c rust: xarray: add __rust_helper to helpers 2026-01-15 10:01:23 +01:00