public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "shankerwangmiao at gmail dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/31468] New: sigisemptyset returns true when the set contains signals larger than 34 Date: Sun, 10 Mar 2024 09:20:14 +0000 [thread overview] Message-ID: <bug-31468-131@http.sourceware.org/bugzilla/> (raw) 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.
next reply other threads:[~2024-03-10 9:20 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2024-03-10 9:20 shankerwangmiao at gmail dot com [this message] 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-31468-131@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).