Re: [PATCH 2/3] vmsplice: make vmsplice a trivial wrapper for preadv2/pwritev2
From: David Laight
Date: Sat Jun 06 2026 - 05:16:34 EST
On Fri, 5 Jun 2026 10:12:05 -0700
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 5 Jun 2026 at 09:30, Florian Weimer <fweimer@xxxxxxxxxx> wrote:
> >
> > > Uhhuh. But that is only specific to 'bool', right?
> >
> > Also char and short.
>
> That sounds like a complete ABI violation as far as I can tell.
>
> Scary. Because I would not be surprised if we have code that assumes otherwise.
>
> Now, the kernel *seldom* uses char/short types, and since compilers
> are typically at least self-consistent in those cases and we don't
> interact directly with untrusted sources.
There are plenty of places where char/short are used for function call
parameters/results (and not for single characters or similar).
I'm sure some people (even some who should really know better) think
the smaller type will save space.
I've always worried about whether the calling or called code is responsible
for ensuring the unused bits are zero (or maybe the sign extension of a
signed value).
Clearly the compiler should obey its own rules - so mostly it is just
extra instruction to do the masking.
But for interactions with asm code, and possibly code that gets mixed
between gcc and clang (maybe for out of tree modules) it does matter.
You also don't really want to be doing maths of char/short (and there
are quite a of of those as well). I think it is only m86 and m68k that
actually have 8/16 bits maths instructions (is s390 old enough?)
everywhere else the compiler has to explicitly mask the high bits.
Maybe it is time to 'nuke' all the 'short' locals/parameters/results
(eg from htons()) as well as all the 'long' for values than aren't
dependant on 32/64 bit builds.
-- David