Re: __X32_SYSCALL_BIT being defined as UL constant breaks userspace

From: Thomas Gleixner
Date: Thu Apr 09 2020 - 03:47:25 EST


Andy Lutomirski <luto@xxxxxxxxxx> writes:
> On Wed, Apr 8, 2020 at 7:34 AM Thorsten Glaser <t.glaser@xxxxxxxxx> wrote:
>> asm/unistd_x32.h:#define __NR_mmap (__X32_SYSCALL_BIT + 9)
>>
>> This construct is, thankfully, still usable in something like
>> #if (__NR_mmap > __NR_somethingelse)
>> but as __X32_SYSCALL_BIT is no longer int its type also isnât.
>>
>> Therefore I ask you to revert this change, bringing x32 closer
>> to all other architectures.
>>
>
> One might reasonably ask whether it makes sense for syscall nrs to be
> signed at all.
>
> 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
> 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.)

Yes.