[PATCH] linux: Enforce zero fill of siginfo_t

Adhemerval Zanella Netto adhemerval.zanella@linaro.org
Mon Jan 19 18:56:47 GMT 2026



On 19/01/26 15:17, Florian Weimer wrote:
> * Adhemerval Zanella Netto:
> 
>> Are you suggesting using memset on test or enforcing it the syscall wrapper?
> 
> I meant that memset seems to be safest bet, putting the fewest
> requirements on the compiler.

Right, but it is not clear to me if you are suggestion doing this
on the pid_send_signal wrapper before issuing the syscall; or doing
on the test for invalid si_code.

> 
>> I think we already do it:
>>
>> sysdeps/unix/sysv/linux/bits/types/siginfo_t.h
>>
>>  51     union
>>  52       {
>>  53         int _pad[__SI_PAD_SIZE];
>>  54
>>  55          /* kill().  */
>>  56         struct
>>  57           {
>>  58             __pid_t si_pid;     /* Sending process ID.  */
>>  59             __uid_t si_uid;     /* Real user ID of sending process.  */
>>  60           } _kill;
>>  61
>>  62         /* POSIX.1b timers.  */
>>
>> The '_pad' should already cover it, I think.
> 
> Ah, and the = { 0 } initializer initializes the array?
> 
> Is that standard C?

Afaik it is standard C (sets first member to 0, zeroes the rest).

> 
> If not, we should really recommend the memset approach.
> 
> Thanks,
> Florian
> 



More information about the Libc-alpha mailing list