[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251223080426-583c4599-264c-4d94-9af0-f67c043c559e@linutronix.de>
Date: Tue, 23 Dec 2025 08:10:49 +0100
From: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
To: "Michael S. Tsirkin" <mst@...hat.com>
Cc: Jason Wang <jasowang@...hat.com>,
Xuan Zhuo <xuanzhuo@...ux.alibaba.com>, Eugenio Pérez <eperezma@...hat.com>,
virtualization@...ts.linux.dev, linux-kernel@...r.kernel.org, Arnd Bergmann <arnd@...db.de>
Subject: Re: [PATCH] virtio: uapi: avoid usage of libc types
On Mon, Dec 22, 2025 at 05:18:26PM -0500, Michael S. Tsirkin wrote:
> On Mon, Dec 22, 2025 at 11:43:52AM +0100, Thomas Weißschuh wrote:
> > On Mon, Dec 22, 2025 at 05:28:30AM -0500, Michael S. Tsirkin wrote:
> > > On Mon, Dec 22, 2025 at 11:22:16AM +0100, Thomas Weißschuh wrote:
> > > > On Mon, Dec 22, 2025 at 03:39:12AM -0500, Michael S. Tsirkin wrote:
> > > > > On Mon, Dec 22, 2025 at 09:00:33AM +0100, 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.
> > > > > >
> > > > > > On Linux 'unsigned long' works as a replacement for 'uintptr_t' and does
> > > > > > not depend on libc.
> > > > > >
> > > > > > Signed-off-by: Thomas Weißschuh <thomas.weissschuh@...utronix.de>
> > > > >
> > > > >
> > > > > are you fixing other uses of uintptr_t ?
> > > >
> > > > I am focussing on UAPI headers which include libc headers.
> > > > virtio_ring.h seems to be the only such header which uses uintptr_t.
> > > > There are a few other UAPI headers which reference uintptr_t, but only
> > > > in comments or macros.
> > > >
> > > > uintptr_t in regular kernel code is out of scope for me.
> > > > While it is iffy, it doesn't actually hurt.
> > > >
> > > >
> > > > Thomas
> > >
> > > And other uses of stdint.h?
> >
> > If they are in UAPI headers I will look at them.
> > I also have a series prepared to prevent new users from creeping in.
>
> I don't mind picking this but I'm just curious what's driving all this
> effort.
It started with a recent change to an UAPI header which introduced a dependency
on libc that broke some things I was doing. See the fix and background in [0].
So I looked into catching such issues earlier, which resulted in [1].
Fortunately there are not many problematic headers [2] in general, so I am now
also fixing those, so the new check can validate more headers and prevent more
regressions.
[0] https://lore.kernel.org/lkml/20251203-uapi-fcntl-v1-1-490c67bf3425@linutronix.de/
[1] https://lore.kernel.org/lkml/20251223-uapi-nostdinc-v1-0-d91545d794f7@linutronix.de/
[2] https://lore.kernel.org/lkml/20251223-uapi-nostdinc-v1-1-d91545d794f7@linutronix.de/
Thomas
Powered by blists - more mailing lists