[PATCH] linux: Enforce zero fill of siginfo_t

Florian Weimer fweimer@redhat.com
Mon Jan 19 18:17:04 GMT 2026


* 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.

> 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?

If not, we should really recommend the memset approach.

Thanks,
Florian



More information about the Libc-alpha mailing list