Re: [PATCH v3 6/6] rust: use strict provenance APIs

kernel test robot
2025-03-15T07:17:31Z

Hi Tamir,

kernel test robot noticed the following build errors:

[auto build test ERROR on a1eb95d6b5f4cf5cc7b081e85e374d1dd98a213b]

url: https://github.com/intel-lab-lkp/linux/commits/Tamir-Duberstein/rust-retain-pointer-mut-ness-in-container_of/20250315-003150
base: a1eb95d6b5f4cf5cc7b081e85e374d1dd98a213b
patch link: https://lore.kernel.org/r/20250314-ptr-as-ptr-v3-6-e7ba61048f4a%40gmail.com
patch subject: [PATCH v3 6/6] rust: use strict provenance APIs
config: x86_64-randconfig-002-20250315 (https://download.01.org/0day-ci/archive/20250315/202503151519.6bGsjUd3-lkp@intel.com/config)
compiler: clang version 19.1.7 (https://github.com/llvm/llvm-project cd708029e0b2869e80abe31ddb175f7c35361f90)
rustc: rustc 1.78.0 (9b00956e5 2024-04-29)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250315/202503151519.6bGsjUd3-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202503151519.6bGsjUd3-lkp@intel.com/

All errors (new ones prefixed by >>):

In file included from arch/x86/kernel/asm-offsets.c:14:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2224:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
***
*** Rust bindings generator 'bindgen' < 0.69.5 together with libclang >= 19.1
*** may not work due to a bug (https://github.com/rust-lang/rust-bindgen/pull/2824),
*** unless patched (like Debian's).
*** Your bindgen version: 0.65.1
*** Your libclang version: 19.1.7
***
***
*** Please see Documentation/rust/quick-start.rst for details
*** on how to set up the Rust support.
***
In file included from rust/helpers/helpers.c:10:
In file included from rust/helpers/blk.c:3:
In file included from include/linux/blk-mq.h:5:
In file included from include/linux/blkdev.h:9:
In file included from include/linux/blk_types.h:10:
In file included from include/linux/bvec.h:10:
In file included from include/linux/highmem.h:8:
In file included from include/linux/cacheflush.h:5:
In file included from arch/x86/include/asm/cacheflush.h:5:
In file included from include/linux/mm.h:2224:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
2 warnings generated.
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
clang diag: include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
>> error[E0425]: cannot find function `with_exposed_provenance` in module `core::ptr`
--> rust/kernel/lib.rs:37:20
|
37 | core::ptr::with_exposed_provenance(addr)
| ^^^^^^^^^^^^^^^^^^^^^^^
|
::: /opt/cross/rustc-1.78.0-bindgen-0.65.1/rustup/toolchains/1.78.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:593:1
|
593 | pub const fn without_provenance<T>(addr: usize) -> *const T {
| ----------------------------------------------------------- similarly named function `without_provenance` defined here
|
help: a function with a similar name exists
|
37 | core::ptr::without_provenance(addr)
| ~~~~~~~~~~~~~~~~~~
help: consider importing this function through its public re-export
|
30 + use crate::with_exposed_provenance;
|
help: if you import `with_exposed_provenance`, refer to it directly
|
37 - core::ptr::with_exposed_provenance(addr)
37 + with_exposed_provenance(addr)
|
--
>> error[E0425]: cannot find function `with_exposed_provenance_mut` in module `core::ptr`
--> rust/kernel/lib.rs:42:20
|
42 | core::ptr::with_exposed_provenance_mut(addr)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
::: /opt/cross/rustc-1.78.0-bindgen-0.65.1/rustup/toolchains/1.78.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ptr/mod.rs:637:1
|
637 | pub const fn without_provenance_mut<T>(addr: usize) -> *mut T {
| ------------------------------------------------------------- similarly named function `without_provenance_mut` defined here
|
help: a function with a similar name exists
|
42 | core::ptr::without_provenance_mut(addr)
| ~~~~~~~~~~~~~~~~~~~~~~
help: consider importing this function through its public re-export
|
30 + use crate::with_exposed_provenance_mut;
|
help: if you import `with_exposed_provenance_mut`, refer to it directly
|
42 - core::ptr::with_exposed_provenance_mut(addr)
42 + with_exposed_provenance_mut(addr)
|
--
>> error[E0599]: no method named `expose_provenance` found for raw pointer `*const T` in the current scope
--> rust/kernel/lib.rs:32:14
|
32 | addr.expose_provenance()
| ^^^^^^^^^^^^^^^^^ method not found in `*const T`
|
= note: try using `<*const T>::as_ref()` to get a reference to the type behind the pointer: https://doc.rust-lang.org/std/primitive.pointer.html#method.as_ref
= note: using `<*const T>::as_ref()` on a pointer which is unaligned or points to invalid or uninitialized memory is undefined behavior

--
0-DAY CI Kernel Test Service