[PATCH] sigaction: don't sign-extend sa_flags
Florian Weimer
fweimer@redhat.com
Mon Jun 2 14:41:05 GMT 2025
* Carlos O'Donell:
> On 6/2/25 8:58 AM, Adhemerval Zanella Netto wrote:
>> On 02/06/25 06:24, Florian Weimer wrote:
>>> * наб:
>>>
>>>> Before:
>>>> rt_sigaction(SIGBUS, {sa_handler=0x55abb9960139, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|SA_SIGINFO|0xffffffff00000000, sa_restorer=0x7fb1b2a82050}, NULL, 8) = 0
>>>>
>>>> After:
>>>> rt_sigaction(SIGBUS, {sa_handler=0x7f6a70dce139, sa_mask=[], sa_flags=SA_RESTORER|SA_RESETHAND|SA_SIGINFO, sa_restorer=0x7f6a70c28f60}, NULL, 8) = 0
>>>>
>>>> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
>>>
>>> I wonder if this is something that should be fixed in strace?
>>>
>>> It's not that the kernel can start using the upper bits with some
>>> compatibility check (e.g., bits 32 and 33 have to be distinct).
>> POSIX defines sa_flags is an 'int' [1], while the rt signal
>> interface
>> uses unsigned (alpha seems to be an outlier, which uses 'int' as well).
>> So I think it should be fixed on strace as well; the high bits usage
>> would
>> be possible only on 64-bit ABIs.
>> [1]
>> https://pubs.opengroup.org/onlinepubs/9799919799/functions/sigaction.html
>
> While I agree that we can't use the high bits, the benefit here is that we'd
> fix older strace output that doesn't yet have the fix Florian is recommending?
>
> I'd be willing to accept this change (with the formatting fixed up) just to
> make strace output better for developers.
I'm not objecting to the patch. Although I'm not sure if a glibc change
is a good way to get better output—I would expect strace to update more
regularly than glibc, particularly for such changes.
Thanks,
Florian
More information about the Libc-alpha
mailing list