lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251209121705.7f6c1117.gary@garyguo.net>
Date: Tue, 9 Dec 2025 12:17:05 +0000
From: Gary Guo <gary@...yguo.net>
To: Xi Ruoyao <xry111@...111.site>
Cc: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>, Huacai Chen 
 <chenhuacai@...nel.org>, WANG Xuerui <kernel@...0n.name>, Alice Ryhl 
 <aliceryhl@...gle.com>, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
 Arve Hjønnevåg  <arve@...roid.com>, Todd Kjos
 <tkjos@...roid.com>, Christian Brauner  <christian@...uner.io>, Carlos
 Llamas <cmllamas@...gle.com>, Björn Roy Baron
 <bjorn3_gh@...tonmail.com>, Danilo Krummrich <dakr@...nel.org>, Benno
 Lossin <lossin@...nel.org>, Boqun Feng <boqun.feng@...il.com>, Andreas
 Hindborg <a.hindborg@...nel.org>, Trevor Gross <tmgross@...ch.edu>,
 loongarch@...ts.linux.dev, rust-for-linux	
 <rust-for-linux@...r.kernel.org>, linux-kernel
 <linux-kernel@...r.kernel.org>
Subject: Re: Mainline loongarch64 defconfig+Rust build error

On Tue, 09 Dec 2025 19:28:33 +0800
Xi Ruoyao <xry111@...111.site> wrote:

> On Tue, 2025-12-09 at 11:56 +0100, Miguel Ojeda wrote:
> > Hi all,
> > 
> > I am seeing in mainline loongarch64 defconfig+Rust the following build
> > error [1].
> > 
> > Cheers,
> > Miguel
> > 
> > [1]
> > 
> >  error[E0425]: cannot find value `compat_ptr_ioctl` in crate `bindings`
> >      --> drivers/android/binder/rust_binder_main.rs:317:38
> >       |
> > 317   |         compat_ioctl: Some(bindings::compat_ptr_ioctl),
> >       |                                      ^^^^^^^^^^^^^^^^ help: a
> > function with a similar name exists: `compat_sys_ioctl`
> >       |
> >      ::: /__w/quick/quick/linux/rust/bindings/bindings_generated.rs:78264:5
> >       |
> > 78264 |     pub fn compat_sys_ioctl(fd: ffi::c_uint, cmd: ffi::c_uint,
> > arg: compat_ulong_t) -> ffi::c_long;
> >       |     ----------------------------------------------------------------------------------------------
> > similarly named function `compat_sys_ioctl` defined here  
> 
> I highly doubt if this is really a LoongArch-only issue.  We have:
> 
> #ifdef CONFIG_COMPAT
> extern long compat_ptr_ioctl(struct file *file, unsigned int cmd, 
>                     unsigned long arg);
> #else
> #define compat_ptr_ioctl NULL
> #endif
> 
> AFAIK bindgen does not translate C preprocessor macro definitions, so
> when !CONFIG_COMPAT we won't have the Rust binding for it.
> 
> And as LA32 is not upstreamed it's pointless to support COMPAT for
> LoongArch, yet.
> 

I think bindgen can't handle this on its own anyway, as it doesn't
really know that you want a `Option<fn(..) -> ...>` type here instead
of just a function item.

Probably the best way is for each user of this function handle
CFG_COMPAT on its own for now. Alternatively, we can just provide a
helper that just returns `-ENONIOCTLCMD` instead of using NULL?

Besat,
Gary

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ