Bug 25657 - sigprocmask() and sigisemptyset() manipulate different amount of sigset_t bytes
Summary: sigprocmask() and sigisemptyset() manipulate different amount of sigset_t bytes
Status: RESOLVED FIXED
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: 2.27
: P2 normal
Target Milestone: 2.32
Assignee: Adhemerval Zanella
URL:
Keywords: glibc_2.27, glibc_2.31
Depends on:
Blocks:
 
Reported: 2020-03-11 19:22 UTC by George Zachos
Modified: 2020-04-21 18:12 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:
fw: security-


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description George Zachos 2020-03-11 19:22:17 UTC
Size of sigset_t is 128 bytes (array of _SIGSET_NWORDS unsigned long ints).
Functions sigemptyset(), sigfillset() and sigismember() access all the 128 bytes of sigset_t, but using sigprocmask to store the current value of the signal mask in a sigset_t variable, results in writing only the first 64 bits [= sizeof(unsigned long int)]. Consequently, the result of function sigisemptyset() depends on the contents of the remaining (_SIGSET_NWORDS - 1) unsigned long ints.

In addition, pthread_sigmask() is also affected, as it is implemented in the same way as sigprocmask().

In the following URL you can find more details about how to reproduce, actual results, system details (including glibc version) etc.: https://unix.stackexchange.com/questions/572172/is-sigprocmask-not-working-correctly
Comment 1 Adhemerval Zanella 2020-04-21 18:12:47 UTC
Fixed on 2.32 (566e10aa7292bacd74d229ca6f2cd9e8c8ba8748).