Re: [PATCH] vfs: use UAPI types for new struct delegation definition

From: Arnd Bergmann

Date: Thu Dec 04 2025 - 04:09:33 EST


On Thu, Dec 4, 2025, at 07:58, Thomas Weißschuh wrote:
> On Wed, Dec 03, 2025 at 03:14:31PM +0100, Arnd Bergmann wrote:
>> > --- a/include/uapi/linux/fcntl.h
>> > +++ b/include/uapi/linux/fcntl.h
>> > @@ -4,11 +4,7 @@
>> >
>> > #include <asm/fcntl.h>
>> > #include <linux/openat2.h>
>> > -#ifdef __KERNEL__
>> > #include <linux/types.h>
>> > -#else
>> > -#include <stdint.h>
>> > -#endif
>>
>> I think we have a couple more files that could use similar changes,
>> but they tend to be at a larger scale:
>
> To start, let's extend the UAPI header tests to detect such dependencies [0].
> Then we can clean them up without new ones popping up.

Sounds good to me. This also caused some problems when I did some
validation to find implicit padding in uapi data structures (using -Wpadded).
I eventually figured out how to build all uapi headers against nolibc
on all architectures with my cross-compilers and clang.

Specifically, I needed some macro definitions for architecture specific
padding in linux/types.h.

I'll have to rebase my patches after -rc1, and we can see if it's
worth upstreaming, either the bits improve the test coverage or
the actual padding annotations I added.

>> include/uapi/xen/privcmd.h
>
> I have no idea how that header is supposed to work at all, as it depends on
> non-UAPI headers. It is also ignored in the UAPI header tests.

This is the hack I'm using to test-build the header, but I don't
think that is what we want upstream:

--- a/include/uapi/xen/privcmd.h
+++ b/include/uapi/xen/privcmd.h
@@ -36,7 +36,12 @@

#include <linux/types.h>
#include <linux/compiler.h>
+#ifdef __KERNEL__
#include <xen/interface/xen.h>
+#else
+typedef __u16 domid_t;
+typedef __u64 xen_pfn_t;
+#endif

struct privcmd_hypercall {
__u64 op;

Arnd