From: hjl@lucon.org (H.J. Lu)
To: ernst.molitor@uni-bonn.de
Cc: egcs@cygnus.com, libc-linux@gnu.ai.mit.edu (GNU C Library),
torvalds@transmeta.com (Linus Torvalds)
Subject: Glibc patch for sigset_t
Date: Sat, 06 Dec 1997 17:06:00 -0000 [thread overview]
Message-ID: <m0xeVAK-0004ecC@ocean.lucon.org> (raw)
In-Reply-To: <199712070058.AAA10450@ernst.molitor>
>
> Dear H. J. Lu,
>
> >BTW, there is a serious problem with 64bit sigset_t in glibc 2.1
> >and linux 2.1.71. It breaks all the old binaries which make system
> >calls with 32bit sigset_t. I think it should be fixed in the kernel
> >first.
>
> this may be good luck (?), but I'm running Linux-2.1.71:
>
> Linux version 2.1.71 (root@localhost) (gcc version egcs-2.90.20 971201 (gcc2-970802 experimental))
>
> on my private box, together with libc-971205 + glibc--971205.diff.gz,
> and have not seen any problems until now...
>
You are lucky. It turns out it is a glibc bug. Here is the patch for
glibc 2.1 971205. That is what happens when you mess around with those
bit fields.
Linus, I still think kernel should make sigset_t 32 bit for the older
system calls and make rt_sigset_t bigger for those new rt_sigxxxxx.
Otherwise, it will cause many trouble for code which uses big sigset_t
with sigxxxxx.
Thanks.
--
H.J. Lu (hjl@gnu.org)
---
Sat Dec 6 17:00:08 1997 H.J. Lu (hjl@gnu.org)
* sysdeps/posix/sigblock.c (__sigblock): Don't check int mask
beyound its size.
* sysdeps/posix/sigsetmask.c (__sigsetmask): Ditto.
* sysdeps/posix/sigvec.c (convert_mask, __sigvec): Ditto.
* sysdeps/unix/bsd/sigsuspend.c (sigsuspend): Ditto.
Index: sysdeps/posix/sigblock.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/sysdeps/posix/sigblock.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sigblock.c
--- sigblock.c 1997/02/25 17:47:54 1.1.1.1
+++ sigblock.c 1997/12/07 00:45:10
@@ -47,7 +47,7 @@
else if (sizeof (unsigned long int) == sizeof (oset))
mask = *(unsigned long int*) &oset;
else
- for (sig = 1, mask = 0; sig < NSIG; ++sig)
+ for (sig = 1, mask = 0; sig < NSIG && sig < sizeof (mask) * 8; ++sig)
if (__sigismember (&oset, sig))
mask |= sigmask (sig);
Index: sysdeps/posix/sigsetmask.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/sysdeps/posix/sigsetmask.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sigsetmask.c
--- sigsetmask.c 1997/02/25 17:47:54 1.1.1.1
+++ sigsetmask.c 1997/12/07 00:46:59
@@ -46,7 +46,7 @@
else if (sizeof (unsigned long int) == sizeof (oset))
mask = *(unsigned long int *) &oset;
else
- for (sig = 1, mask = 0; sig < NSIG; ++sig)
+ for (sig = 1, mask = 0; sig < NSIG && sig < sizeof (mask) * 8; ++sig)
if (__sigismember (&oset, sig))
mask |= sigmask (sig);
Index: sysdeps/posix/sigvec.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/sysdeps/posix/sigvec.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sigvec.c
--- sigvec.c 1997/02/25 17:47:54 1.1.1.1
+++ sigvec.c 1997/12/07 00:49:04
@@ -62,7 +62,7 @@
if (__sigemptyset (set) < 0)
return -1;
- for (sig = 1; sig < NSIG; ++sig)
+ for (sig = 1; sig < NSIG && sig < sizeof (mask) * 8; ++sig)
if ((mask & sigmask (sig)) && __sigaddset (set, sig) < 0)
return -1;
}
@@ -138,7 +138,7 @@
else if (sizeof (unsigned long int) == sizeof (sigset_t))
mask = *(unsigned long int *) &old.sa_mask;
else
- for (i = 1; i < NSIG; ++i)
+ for (i = 1; i < NSIG && i < sizeof (mask) * 8; ++i)
if (__sigismember(&old.sa_mask, i))
mask |= sigmask(i);
Index: sysdeps/unix/bsd/sigsuspend.c
===================================================================
RCS file: /home/work/cvs/gnu/glibc/sysdeps/unix/bsd/sigsuspend.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 sigsuspend.c
--- sigsuspend.c 1997/02/25 17:48:00 1.1.1.1
+++ sigsuspend.c 1997/12/07 00:50:18
@@ -38,7 +38,7 @@
}
mask = 0;
- for (sig = 1; sig <= NSIG; ++sig)
+ for (sig = 1; sig <= NSIG && sig < sizeof (mask) * 8; ++sig)
if (__sigismember (set, sig))
mask |= sigmask (sig);
prev parent reply other threads:[~1997-12-06 17:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <199712062040.UAA29198@ernst.molitor>
1997-12-06 15:11 ` egcs patch for glibc 2.1 H.J. Lu
1997-12-06 16:58 ` ernst.molitor
1997-12-06 17:06 ` H.J. Lu [this message]
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=m0xeVAK-0004ecC@ocean.lucon.org \
--to=hjl@lucon.org \
--cc=egcs@cygnus.com \
--cc=ernst.molitor@uni-bonn.de \
--cc=libc-linux@gnu.ai.mit.edu \
--cc=torvalds@transmeta.com \
/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: link
Be 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).