Re: __X32_SYSCALL_BIT being defined as UL constant breaks userspace

From: Thorsten Glaser
Date: Thu Apr 09 2020 - 03:57:04 EST


On Wed, 8 Apr 2020, Andy Lutomirski wrote:

> One might reasonably ask whether it makes sense for syscall nrs to be
> signed at all.

It doesnât, but itâs probably this way for hysteric raisins.

> But regardless, this breaks userspace and we should fix it. I can
> whip up a patch to split it into X32_SYSCALL_BIT (unsigned long) and
> __X32_SYSCALL_BIT (uapi, int). Thomas, etc, does this seem

This would help with the issue, thanks.

> reasonable? (For those not following all the machinations, this
> change caused some userspace build failures in libseccomp and/or
> systemd for reasons that are vaguely silly.)

Not very silly:

printf("%d\n", __NR_mmap);

That with -Wformat and -Werror (or -Werror=format) rightfully warns,
as the compiler cannot, on x32 (where int=long), detect that, on
architectures where intâlong the constant is int.

Even worse, switching userspace to unsigned long globally would
completely hose this on LP64 architectures.

So this is, in my opinion, completely justified. (Disclaimer: Iâm
not affiliated with systemd and not even running it except udev.)

bye,
//mirabilos
--
tarent solutions GmbH
RochusstraÃe 2-4, D-53123 Bonn â http://www.tarent.de/
Tel: +49 228 54881-393 â Fax: +49 228 54881-235
HRB 5168 (AG Bonn) â USt-ID (VAT): DE122264941
GeschÃftsfÃhrer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg