[PATCH v10] linux: Add support for getrandom vDSO

Florian Weimer fweimer@redhat.com
Mon Dec 30 13:15:25 GMT 2024


* Adhemerval Zanella:

> +/* Allocate an opaque state for vgetrandom.  If the grnd_alloc does not have
> +   any, mmap() another page of them using the vgetrandom parameters.  */
> +static void *
> +vgetrandom_get_state (void)
> +{
> +  void *state = NULL;
> +
> +  /* The signal blocking avoid the potential issue where _Fork() (which is
> +     async-signal-safe) is called with the lock taken.  The function is
> +     called only once during thread lifetime, so the overhead should be
> +     minimal.  */
> +  internal_sigset_t set;
> +  internal_signal_block_all (&set);
> +  __libc_lock_lock (grnd_alloc.lock);

This caused a regression in dhcpcd because it did not have
__NR_rt_sigprocmask in its seccomp allowlist:

  dhcpcd crashes with SIGSYS with latest Ferdora 41
  <https://github.com/NetworkConfiguration/dhcpcd/issues/421>

I investigated if we can avoid the new system call if no signals have
been installed, but I don't think it would help dhcpcd because it has
signal handlers, so it doesn't look like its worth the effort.

Thanks,
Florian



More information about the Libc-alpha mailing list