public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/31468] New: sigisemptyset returns true when the set contains signals larger than 34
@ 2024-03-10 9:20 shankerwangmiao at gmail dot com
2024-03-10 9:22 ` [Bug libc/31468] " shankerwangmiao at gmail dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: shankerwangmiao at gmail dot com @ 2024-03-10 9:20 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31468
Bug ID: 31468
Summary: sigisemptyset returns true when the set contains
signals larger than 34
Product: glibc
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libc
Assignee: unassigned at sourceware dot org
Reporter: shankerwangmiao at gmail dot com
CC: drepper.fsp at gmail dot com
Target Milestone: ---
Hi,
I found that there might be a bug in `sigisemptyset`. The following code
reproduces this issue:
```c
#define _GNU_SOURCE
#include<signal.h>
#include<stdio.h>
#include<stdlib.h>
int main(){
sigset_t set;
int rc = sigemptyset(&set);
if (rc < 0){
perror("sigemptyset");
exit(1);
}
printf("NSIG=%d\n", NSIG);
rc = sigaddset(&set, 34);
if (rc < 0){
perror("sigaddset");
exit(1);
}
printf("isemptyset: %d\n", sigisemptyset(&set));
printf("ismember(34): %d\n", sigismember(&set, 34));
return 0;
}
```
`sigisemptyset` returns 1 even when the signal number 34 is in the set.
The bug may be related to the following code:
https://elixir.bootlin.com/glibc/glibc-2.39/source/sysdeps/unix/sysv/linux/sigsetops.h#L69
where the variable `ret` is declared as `int` rather than `unsigned long int`,
which is used in `struct __sigset_t`. On 64bit platforms where `long` is 64
bits and `int` is 32 bits, the above code leaves the higher 32 bits of each
`__val` member unchecked.
I wonder if this is intended or a bug.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/31468] sigisemptyset returns true when the set contains signals larger than 34
2024-03-10 9:20 [Bug libc/31468] New: sigisemptyset returns true when the set contains signals larger than 34 shankerwangmiao at gmail dot com
@ 2024-03-10 9:22 ` shankerwangmiao at gmail dot com
2024-03-10 10:48 ` schwab@linux-m68k.org
2024-03-12 9:03 ` schwab@linux-m68k.org
2 siblings, 0 replies; 4+ messages in thread
From: shankerwangmiao at gmail dot com @ 2024-03-10 9:22 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31468
Miao Wang <shankerwangmiao at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |shankerwangmiao at gmail dot com
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/31468] sigisemptyset returns true when the set contains signals larger than 34
2024-03-10 9:20 [Bug libc/31468] New: sigisemptyset returns true when the set contains signals larger than 34 shankerwangmiao at gmail dot com
2024-03-10 9:22 ` [Bug libc/31468] " shankerwangmiao at gmail dot com
@ 2024-03-10 10:48 ` schwab@linux-m68k.org
2024-03-12 9:03 ` schwab@linux-m68k.org
2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2024-03-10 10:48 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31468
--- Comment #1 from Andreas Schwab <schwab@linux-m68k.org> ---
This is broken since the beginning of time.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug libc/31468] sigisemptyset returns true when the set contains signals larger than 34
2024-03-10 9:20 [Bug libc/31468] New: sigisemptyset returns true when the set contains signals larger than 34 shankerwangmiao at gmail dot com
2024-03-10 9:22 ` [Bug libc/31468] " shankerwangmiao at gmail dot com
2024-03-10 10:48 ` schwab@linux-m68k.org
@ 2024-03-12 9:03 ` schwab@linux-m68k.org
2 siblings, 0 replies; 4+ messages in thread
From: schwab@linux-m68k.org @ 2024-03-12 9:03 UTC (permalink / raw)
To: glibc-bugs
https://sourceware.org/bugzilla/show_bug.cgi?id=31468
Andreas Schwab <schwab@linux-m68k.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Target Milestone|--- |2.40
Resolution|--- |FIXED
--- Comment #2 from Andreas Schwab <schwab@linux-m68k.org> ---
Fixed by commit 2173173d57.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-03-12 9:03 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-10 9:20 [Bug libc/31468] New: sigisemptyset returns true when the set contains signals larger than 34 shankerwangmiao at gmail dot com
2024-03-10 9:22 ` [Bug libc/31468] " shankerwangmiao at gmail dot com
2024-03-10 10:48 ` schwab@linux-m68k.org
2024-03-12 9:03 ` schwab@linux-m68k.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).