From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AA2843858C55; Sun, 10 Mar 2024 09:20:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AA2843858C55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1710062415; bh=O75VFU9UVhnO2ikhOnkzvgX2f3Sz0NEJKGjz6p9kLU8=; h=From:To:Subject:Date:From; b=rleM0bdCMArUrPZ4WUeJeTn/DSLtzY9UNmElXfIc1H/MPf4RBKqFeR7SpX7U9UIcM +YG5ZGbelcauY0nowcKxQKvCyXgb4+0TPujOOV8KbrFuO81w1b0pdnjxXuF7SJGiZV GJvXBrwTL+TSN0LsupGKQZU6atuyd680x+iKdzD0= From: "shankerwangmiao at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: libc X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: shankerwangmiao at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cc target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31468 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 #include #include int main(){ sigset_t set; int rc =3D sigemptyset(&set); if (rc < 0){ perror("sigemptyset"); exit(1); } printf("NSIG=3D%d\n", NSIG); rc =3D 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.=20 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 in= t`, 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. --=20 You are receiving this mail because: You are on the CC list for the bug.=