[PATCH] linux: Enforce zero fill of siginfo_t

Florian Weimer fweimer@redhat.com
Mon Jan 19 17:08:30 GMT 2026


* Adhemerval Zanella:

> The glibc siginfo struct is larger than the kABI one, and the kernel
> enforces that for an unknown si_code, all the extra bytes should be 0
> (post_copy_siginfo_from_user).
>
> For armhf, gcc-15 is fully zero-filling the struct (it seems to be a
> compiler issue, although I haven't found any already registered on
> gcc bugzilla).
>
> In any case, to avoid false positives, force zero-filling on the
> structure.
>
> Checked on arm-linux-gnueabihf.
> ---
>  sysdeps/unix/sysv/linux/tst-pidfd.c | 14 ++++++--------
>  1 file changed, 6 insertions(+), 8 deletions(-)
>
> diff --git a/sysdeps/unix/sysv/linux/tst-pidfd.c b/sysdeps/unix/sysv/linux/tst-pidfd.c
> index d50e36b18a..d65e3960ac 100644
> --- a/sysdeps/unix/sysv/linux/tst-pidfd.c
> +++ b/sysdeps/unix/sysv/linux/tst-pidfd.c
> @@ -210,14 +210,12 @@ do_test (void)
>    /* Wait for second sigtimedwait.  */
>    support_process_state_wait (pid, support_process_state_sleeping);
>    {
> -    siginfo_t info =
> -      {
> -	.si_signo = SIGUSR2,
> -	.si_errno = EAGAIN,
> -	.si_code = -10,
> -	.si_pid = ppid,
> -	.si_uid = puid
> -      };
> +    siginfo_t info = { 0 };
> +    info.si_signo = SIGUSR2;
> +    info.si_errno = EAGAIN;
> +    info.si_code = -10;
> +    info.si_pid = ppid;
> +    info.si_uid = puid;
>      TEST_COMPARE (pidfd_send_signal (pidfd, SIGUSR2, &info, 0), 0);
>    }

Aren't those two equivalent?  Is the issue about padding?

Thanks,
Florian



More information about the Libc-alpha mailing list