[PATCH] nptl: Retry SIGSETXID delivery on EAGAIN in setxid (bug 21108)

Andreas Schwab schwab@suse.de
Wed Jun 10 14:20:14 GMT 2026


On Jun 09 2026, Adhemerval Zanella wrote:

> @@ -150,31 +150,86 @@ setxid_unmark_thread (struct xid_command *cmdp, struct pthread *t)
>  }
>  
>  
> -static int
> +enum setxid_signal_state
> +{
> +  setxid_signal_done,  /* Thread  has not finished starting or has already
> +			  exited; ignore it.  */
> +  setxid_signal_sent,  /* The signal was delivered and the thread signal
> +			  handler will run (the xid_command::crnt was already
> +			  incremented.  */
> +  setxid_signal_retry, /* tgkill returned EAGAIN (the signal queue
> +			  RLIMIT_SIGPENDING is full), the thread is still
> +			  running and must be signal.  The caller has to
                                              signaled

> +  /* The kernel might return EAGAIN for realtime signals if the signal queue
> +     reaches its limits (RLIMIT_SIGPENDING) because tgkill does not use the
> +     guaranteed-delivery override path as the kill syscall.  The threads is
                                                                    thread

> +     still running and *must* process the credential change, so instruc the
                                                                   instruct

> +/* The sexid is implemented on Linux with a SIGSETXID broadcast, and tgkill
> +   might fail with EAGAIN if the signal queue is full (RLIMIT_SIGPENDING)
> +   because SIGSETXID is a realtime signal.
> +
> +   The test first fills the queue, run the setresuid in a helper thread, and
                                      runs

> +   verifiers that it does *not* complete while the queue is still full.
      verifies

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


More information about the Libc-alpha mailing list