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: <20251223092253-6c03d7f4-04c7-4272-a4e8-9e38f41f4dad@linutronix.de>
Date: Tue, 23 Dec 2025 09:37:04 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: Bernd Schubert <bernd@...ernd.com>
Cc: Miklos Szeredi <miklos@...redi.hu>, linux-fsdevel@...r.kernel.org, 
	linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] fuse: uapi: use UAPI types

Hi Bernd,

On Mon, Dec 22, 2025 at 10:16:39PM +0100, Bernd Schubert wrote:
> On 12/22/25 09:06, Thomas Weißschuh wrote:
> > Using libc types and headers from the UAPI headers is problematic as it
> > introduces a dependency on a full C toolchain.
> > 
> > Use the fixed-width integer types provided by the UAPI headers instead.
> > 
> > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
> 
> I think that came up a couple of times already. 
> 
> https://lkml.org/lkml/2015/10/15/672
> 
> Also see
> https://git.zx2c4.com/linux-rng/commit/include/uapi/linux/fuse.h?id=4c82456eeb4da081dd63dc69e91aa6deabd29e03&follow=1

Thanks for these pointers.

Looking at the linked commit 4c82456eeb4d ("fuse: fix type definitions in
uapi header"), it seems you were fine with custom typedefs/defines for
non-Linux targets. But the way it was done previously was problematic for
cross-compilation.

What about the following aproach:

#if defined(__KERNEL__)
#include <linux/types.h>
#elif defined(__linux__)
#include <linux/types.h>
#else
#include <stdint.h>
typedef uint32_t __u32;
...
#endif

(borrowed from include/uapi/drm/drm.h, the identical #if/#elif branches are
necessary for unifdef.

This works correctly when (cross-)compiling the kernel itself. It also uses
the standard UAPI types when used from Linux userspace and also works on
non-Linux userspace. And the header can still be copied into libfuse as is.


Thomas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ