This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: realtime signals corrupted by pause() on ia64


On Mon, Feb 24, 2003 at 09:07:42AM +1100, Keith Owens wrote:
> It is a glibc bug on ia64, which exists on at least glibc-2.2.4-30 and
> glibc-2.2.4-31 (RH AS 2.1).  pause() incorrectly maps sigset from long
> to words and corrupts the high order word of the mask (contains the
> blocked realtime signals), letting signals through that should be
> blocked.  Minimal test case below based on Greg's code.  Works fine on
> ia32, fails on ia64.

This patch fixes it for me, but I have not tried it on x86 as I don't
have a convenient build environment on any x86 machines.

as i understand it, sigset_set_old_mask should just set 'set' to be
the mask passed in.  thinking about how the original works makes my
brain hurt ...

after applying it I get this output which I think is right :
c start 2768
c after defining testsig
c after defining alrm
c setup complete
p sending signal 45
c caught signal 14 - ignored
c releasing signal 45
c caught signal 45
p Child exited with status 0

-i
ianw at gelato dot unsw dot edu dot au
http://www.gelato.unsw.edu.au

--- /home/ianw/libc/sysdeps/unix/sysv/linux/sigset-cvt-mask.h   2002-09-06 04:51:45.000000000 +1000
+++ sysdeps/unix/sysv/linux/sigset-cvt-mask.h   2003-02-24 14:07:37.000000000 +1100
@@ -22,19 +22,13 @@
 static inline int __attribute__ ((unused))
 sigset_set_old_mask (sigset_t *set, int mask)
 {
-  unsigned long int *ptr;
-  int cnt;
-
-  ptr = &set->__val[0];
-
-  *ptr++ = (unsigned int) mask;
-
-  cnt = _SIGSET_NWORDS - 2;
-  do
-    *ptr++ = 0ul;
-  while (--cnt >= 0);
-
-  return 0;
+       int __sig;
+       for ( __sig = 1 ; __sig < NSIG ; __sig++ ) {
+               if ( mask & sigmask(__sig) )
+                       if ( __sigaddset(set, __sig) < 0 )
+                               return -1;
+       }
+       return 0;
 }
  
 static inline int __attribute__ ((unused))


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]