Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250608170923.GM1827@brightrain.aerifal.cx>
Date: Sun, 8 Jun 2025 13:09:32 -0400
From: Rich Felker <dalias@...c.org>
To: Bobby Bingham <koorogi@...rogi.info>
Cc: musl@...ts.openwall.com
Subject: Re: The `sigpause` function behavior does not fully comply
 with the POSIX specification

On Sun, Jun 08, 2025 at 11:53:44AM -0500, Bobby Bingham wrote:
> On 6/8/25 10:43, Haelwenn (lanodan) Monnier wrote:
> > 
> > This manpage isn't the POSIX standard but Linux own manpage (which for C
> > documents glibc behavior).
> 
> Yes.
> 
> > 
> > See https://pubs.opengroup.org/onlinepubs/9699919799/functions/
> > sigpause.html for POSIX.1-2018
> > where EINVAL is allowed and sigpause returns SIG_ERR (defined by musl in
> > <signal.h> to ((void (*)(int))-1) ).
> 
> That page says:
> 
>     The sigpause() function shall suspend execution of the thread until
>     a signal is received, whereupon it shall return -1 and set errno to
>     [EINTR].
> 
> This reads to me that sigpause is only permitted to set errno to EINTR, and
> not to return other errors. The list of errors would seem to apply to the
> other functions on the page, which are documented to "use errno to indicate
> the error."

That's specifying the behavior on successful return, not on errors.

The ERRORS section says:

    These functions shall fail if:

    [EINVAL]
        The sig argument is an illegal signal number. 

Seems pretty clear. This is a "shall fail" (mandatory) not a "may
fail", so detecting the invalid signal number and failing with EINVAL
is mandatory. The old behavior of ignoring it was non-conforming.

See: https://pubs.opengroup.org/onlinepubs/9699919799/functions/sigpause.html

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.