next-20241101: rust/kernel/security.rs - error[E0061]: this function takes 2 arguments but 3 arguments were supplied

From: Naresh Kamboju
Date: Fri Nov 01 2024 - 05:01:44 EST


The rustclang-lkftconfig-kselftest builds failed with rust clang on the
Linux next-20241101 tag.

First seen on Linux next-20241101 tag.
Good: next-20241031
Bad: next-20241101

arm64:
build:
* rustclang-lkftconfig-kselftest

Reported-by: Linux Kernel Functional Testing <lkft@xxxxxxxxxx>

Build log:
---------
error[E0061]: this function takes 2 arguments but 3 arguments were supplied
--> rust/kernel/security.rs:32:28
|
32 | to_result(unsafe {
bindings::security_secid_to_secctx(secid, &mut secdata, &mut seclen)
})?;
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
----------- unexpected argument #3 of type `&mut
u32`
|
note: expected `*mut lsm_context`, found `&mut *mut _`
--> rust/kernel/security.rs:32:70
|
32 | to_result(unsafe {
bindings::security_secid_to_secctx(secid, &mut secdata, &mut seclen)
})?;
|
^^^^^^^^^^^^
= note: expected raw pointer `*mut bindings::lsm_context`
found mutable reference `&mut *mut _`
note: function defined here
--> /home/tuxbuild/.cache/tuxmake/builds/1/build/rust/bindings/bindings_generated.rs:76185:12
|
76185 | pub fn security_secid_to_secctx(secid: u32_, cp: *mut
lsm_context) -> core::ffi::c_int;
| ^^^^^^^^^^^^^^^^^^^^^^^^
help: consider removing the borrow
|
32 - to_result(unsafe {
bindings::security_secid_to_secctx(secid, &mut secdata, &mut seclen)
})?;
32 + to_result(unsafe {
bindings::security_secid_to_secctx(secid, secdata, &mut seclen) })?;
|
help: remove the extra argument
|
32 - to_result(unsafe {
bindings::security_secid_to_secctx(secid, &mut secdata, &mut seclen)
})?;
32 + to_result(unsafe {
bindings::security_secid_to_secctx(secid, /* *mut
bindings::lsm_context */) })?;
|

error[E0061]: this function takes 1 argument but 2 arguments were supplied
--> rust/kernel/security.rs:72:18
|
72 | unsafe {
bindings::security_release_secctx(self.secdata, self.seclen as u32) };
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
------------------ unexpected argument #2 of type `u32`
|
note: expected `*mut lsm_context`, found `*mut i8`
--> rust/kernel/security.rs:72:52
|
72 | unsafe {
bindings::security_release_secctx(self.secdata, self.seclen as u32) };
| ^^^^^^^^^^^^
= note: expected raw pointer `*mut bindings::lsm_context`
found raw pointer `*mut i8`
note: function defined here
--> /home/tuxbuild/.cache/tuxmake/builds/1/build/rust/bindings/bindings_generated.rs:76201:12
|
76201 | pub fn security_release_secctx(cp: *mut lsm_context);
| ^^^^^^^^^^^^^^^^^^^^^^^
help: remove the extra argument
|
72 - unsafe {
bindings::security_release_secctx(self.secdata, self.seclen as u32) };
72 + unsafe { bindings::security_release_secctx(/* *mut
bindings::lsm_context */) };
|

error: aborting due to 2 previous errors

For more information about this error, try `rustc --explain E0061`.
make[3]: *** [rust/Makefile:405: rust/kernel.o] Error 1

Build image:
-----------
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2oEm06IqsdrtzGl1UIGSDghznWx/
- https://qa-reports.linaro.org/lkft/linux-next-master/build/next-20241101/testrun/25629042/suite/build/test/rustclang-lkftconfig-kselftest/log

Steps to reproduce:
------------
- # tuxmake --runtime podman --target-arch arm64 --toolchain rustclang \
--kconfig defconfig \
--kconfig-add
https://gitlab.com/Linaro/lkft/kernel-fragments/-/raw/main/systemd.config
\
--kconfig-add tools/testing/selftests/rust/config \
LLVM=1 LLVM_IAS=1 TARGETS=rust \
debugkernel dtbs dtbs-legacy headers kernel kselftest modules
- https://storage.tuxsuite.com/public/linaro/lkft/builds/2oEm06IqsdrtzGl1UIGSDghznWx/tuxmake_reproducer.sh

metadata:
----
git describe: next-20241101
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
git sha: c88416ba074a8913cf6d61b789dd834bbca6681c
kernel config:
https://storage.tuxsuite.com/public/linaro/lkft/builds/2oEm06IqsdrtzGl1UIGSDghznWx/config
build url: https://storage.tuxsuite.com/public/linaro/lkft/builds/2oEm06IqsdrtzGl1UIGSDghznWx/
toolchain: rustclang
config: defconfig
arch: arm64

--
Linaro LKFT
https://lkft.linaro.org