Skip to contentSkip to conversation

ppc64: Fix 32 bits conversion of SI_TIMER signals

PATCH Benjamin Herrenschmidt 2 participants 4 messages Sep 26, 2004 – Oct 3, 2004 1 message not in the archive Generic include/asm header files

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 11 lines · Linux Kernel Mailing List

ChangeSet 1.1991, 2004/09/25 18:41:38-07:00, [email protected]

[PATCH] ppc64: Fix 32 bits conversion of SI_TIMER signals

The current 32 bits translation of the SI_TIMER is wrong on ppc64, causing the tst-timer4 testcase of glibc to fail in 32 bits. This patch fixes it.

Agh !

I had two patches, a broken one and a good one and ... of course I sent the broken one, sorry :(

Can you still back it out ?

Here is the correct one:

ppc64: Fix 32 bits conversion of SI_TIMER signals

The current 32 bits translation of the SI_TIMER is wrong on ppc64, causing the tst-timer4 testcase of glibc to fail in 32 bits. This patch fixes it.

===== arch/ppc64/kernel/signal32.c 1.57 vs edited =====

arch/ppc64/kernel/signal32.c +5 -1
@@ -472,9 +472,13 @@
 				  &d->si_addr);
 		break;
 	case __SI_POLL >> 16:
-	case __SI_TIMER >> 16:
 		err |= __put_user(s->si_band, &d->si_band);
 		err |= __put_user(s->si_fd, &d->si_fd);
+		break;
+	case __SI_TIMER >> 16:
+		err |= __put_user(s->si_tid, &d->si_tid);
+		err |= __put_user(s->si_overrun, &d->si_overrun);
+		err |= __put_user(s->si_int, &d->si_int);
 		break;
 	case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
 	case __SI_MESGQ >> 16:

===== include/asm-ppc64/ppc32.h 1.16 vs edited =====

include/asm-ppc64/ppc32.h +4 -2
@@ -32,8 +32,10 @@
 
 		/* POSIX.1b timers */
 		struct {
-			unsigned int _timer1;
-			unsigned int _timer2;
+			timer_t _tid;			/* timer id */
+			int _overrun;			/* overrun count */
+			compat_sigval_t _sigval;		/* same as below */
+			int _sys_private;		/* not to be passed to user */
 		} _timer;
 
 		/* POSIX.1b signals */
#2 lore raw

Ben, have you taken a quick look to see if any other platforms doing compat stuff need a fix like this as well? If not, could you do so real quick? Thanks.

#3 lore raw
Quoted 3 lines · David S. Miller

Ben, have you taken a quick look to see if any other platforms doing compat stuff need a fix like this as well? If not, could you do so real quick? Thanks.

Olaf signaled me some other failures of glibc make check, so I need to spend more time on that.

As far as SI_TIMER is concerned, I first copied the sparc64 "fix" and it appeared to be wrong, I'm not sure at this point if it's a different alignement of the int and the void * in the union or if the sparc fix was just wrong in the first place.

Ben.

#4 lore raw
Quoted 4 lines · On Wed, 29 Sep 2004 09:13:38 +1000 Benjamin Herrenschmidt…

As far as SI_TIMER is concerned, I first copied the sparc64 "fix" and it appeared to be wrong, I'm not sure at this point if it's a different alignement of the int and the void * in the union or if the sparc fix was just wrong in the first place.

Ok, I'm now using the same code as ppc64 on sparc64. Thanks for working on this and explaining things.