Re: [PATCH] Fix invalid sigprocmask call

Yousong Zhou
2017-03-24T12:39:39Z

yousong

On 24 March 2017 at 20:23, Yousong Zhou <yszhou4tech@gmail.com> wrote:
> On 24 March 2017 at 18:47, Pedro Alves <palves@redhat.com> wrote:
>> On 03/24/2017 03:01 AM, Yousong Zhou wrote:
>>> The POSIX document says
>>>
>>> The pthread_sigmask() and sigprocmask() functions shall fail if:
>>>
>>> [EINVAL]
>>> The value of the how argument is not equal to one of the defined values.
>>>
>>> and this is how musl-libc is currently doing. Fix the call to be safe
>>> and correct
>>>
>>> [1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_sigmask.html
>>>
>>
>> I don't agree. It's a musl bug. Please fix it / file a musl bug.
>
> I already did that before sending to gdb-patches
>
> http://www.openwall.com/lists/musl/2017/03/24/1
>
> I am aware of the fact that the current code works with glibc and mac
> osx 10.11.6. The Linux kernel code at the moment also accepts the
> call with how==0
>
> But this is more about interpretation of POSIX document itself. And
> it says, clearly without pre-condition words or ambiguity in the
> ERRORS section of that page, to return EINVAL if how is not equal to
> one of the defined values.
>
> I also tried to find some posix-compliant testsuite and to search the
> github code for samples of pthread_sigmask call. The first I came
> across was the following code snippet at link
> https://github.com/juj/posixtestsuite/blob/master/conformance/interfaces/pthread_sigmask/8-1.c#L57
>
> pthread_sigmask(SIG_BLOCK, NULL, &oactl);
>
>
> Regards,
> yousong

The following test case will also say for itself.

https://github.com/juj/posixtestsuite/blob/master/conformance/interfaces/pthread_sigmask/16-1.c

Regards,
yousong