glibc fails in tst-timer4, __SI_TIMER needs its own case

Olaf Hering olh at suse.de
Sun Sep 26 03:39:19 EST 2004


 On Sat, Sep 25, Benjamin Herrenschmidt wrote:

> +               err |= __put_user(s->si_value, &d->si_value);

This doesnt work for some reason. If that value is 0x1234567800000000,
the upper bits are ignored. That 0x12345678 is the &ev pointer in
tst-timer4.c, passed to timer_create. ppc32_timer_create takes it as an
int, see event.sigev_value.sival_int

+		err |= __put_user(s->si_int, &d->si_int);

This patch seems to fix it for me, this is the debug output:

clock_gettime returned timespec = { 1096132996, 951020000 }
clock_getres returned timespec = { 0, 999848 }
!!! second timer_gettime timer_none returned it_interval 0.100984648
e54:/usr/src/packages/BUILD/glibc-2.3/rt$ dmesg 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j182037 si_ptr ffffe03000000000 s24 d20 d 0x00000000ffffd9f0 p 0x00000000ffffd9f0
00000021 00000000 fffffffe 02000001 00000000 ffffe030 00000000 00000000 
00000021 00000000 0001fffe 00000000 02000001 00000000 ffffe030 00000000 00000000 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j182137 si_ptr 000000a300000000 s24 d20 d 0x00000000ffffd9f0 p 0x00000000ffffd9f0
00000022 00000000 fffffffe 03000002 00000000 000000a3 00000000 00000000 
00000022 00000000 0001fffe 00000000 03000002 00000000 000000a3 00000000 00000000 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j183438 si_ptr ffffe03000000000 s24 d20 d 0x00000000ffffd9c0 p 0x00000000ffffd9c0
00000021 00000000 fffffffe 02000001 00000000 ffffe030 0ff90e5c ffffd9e0 
00000021 00000000 0001fffe 00000000 02000001 00000000 ffffe030 00000000 00000005 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j183538 si_ptr 000000a300000000 s24 d20 d 0x00000000ffffd9c0 p 0x00000000ffffd9c0
00000022 00000000 fffffffe 03000002 00000000 000000a3 0ff90e5c ffffd9e0 
00000022 00000000 0001fffe 00000000 03000002 00000000 000000a3 00000000 00000005 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j183839 si_ptr ffffe03000000000 s24 d20 d 0x00000000ffffd9c0 p 0x00000000ffffd9c0
00000021 00000000 fffffffe 02000001 00000000 ffffe030 0ff90e5c ffffd9e0 
00000021 00000000 0001fffe 00000000 02000001 00000000 ffffe030 00000000 00000007 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j184039 si_ptr 000000a300000000 s24 d20 d 0x00000000ffffd9c0 p 0x00000000ffffd9c0
00000022 00000000 fffffffe 03000002 00000000 000000a3 0ff90e5c ffffd9e0 
00000022 00000000 0001fffe 00000000 03000002 00000000 000000a3 00000000 00000007 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j184240 si_ptr ffffe03000000000 s24 d20 d 0x00000000ffffd9c0 p 0x00000000ffffd9c0
00000021 00000000 fffffffe 02000001 00000000 ffffe030 0ff90e5c ffffd9e0 
00000021 00000000 0001fffe 00000000 02000001 00000000 ffffe030 00000000 00000009 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j184540 si_ptr 000000a300000000 s24 d20 d 0x00000000ffffd9c0 p 0x00000000ffffd9c0
00000022 00000000 fffffffe 03000002 00000000 000000a3 0ff90e5c ffffd9e0 
00000022 00000000 0001fffe 00000000 03000002 00000000 000000a3 00000000 00000009 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j184641 si_ptr ffffe03000000000 s24 d20 d 0x00000000ffffd9f0 p 0x00000000ffffd9f0
00000021 00000000 fffffffe 02000001 00000000 ffffe030 00000000 00000000 
00000021 00000000 0001fffe 00000000 02000001 00000000 ffffe030 00000000 0000000b 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j185041 si_ptr 000000a300000000 s24 d20 d 0x00000000ffffd9f0 p 0x00000000ffffd9f0
00000022 00000000 fffffffe 03000002 00000000 000000a3 00000000 00000000 
00000022 00000000 0001fffe 00000000 03000002 00000000 000000a3 00000000 0000000b 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j185042 si_ptr ffffe03000000000 s24 d20 d 0x00000000ffffd9f0 p 0x00000000ffffd9f0
00000021 00000000 fffffffe 02000001 00000000 ffffe030 00000000 00000000 
00000021 00000000 0001fffe 00000000 02000001 00000000 ffffe030 00000000 0000000d 00000000 00000000 00000000 
copy_siginfo_to_user32(476) ld.so.1(3784):c1,j185542 si_ptr 000000a300000000 s24 d20 d 0x00000000ffffd9f0 p 0x00000000ffffd9f0
00000022 00000000 fffffffe 03000002 00000000 000000a3 00000000 00000000 
00000022 00000000 0001fffe 00000000 03000002 00000000 000000a3 00000000 0000000d 00000000 00000000 00000000 



diff -purNX /tmp/kernel_exclude.txt ../linux-2.6.5.orig/Makefile ./Makefile
--- ../linux-2.6.5.orig/Makefile	2004-09-25 13:38:59.000000000 +0000
+++ ./Makefile	2004-09-25 14:49:12.660598245 +0000
@@ -753,10 +753,8 @@ _modinst_:
 	@rm -rf $(MODLIB)/kernel
 	@rm -f $(MODLIB)/source
 	@mkdir -p $(MODLIB)/kernel
-	@ln -s $(srctree) $(MODLIB)/source
 	@if [ ! $(objtree) -ef  $(MODLIB)/build ]; then \
 		rm -f $(MODLIB)/build ; \
-		ln -s $(objtree) $(MODLIB)/build ; \
 	fi
 	$(Q)$(MAKE) -rR -f $(srctree)/scripts/Makefile.modinst
 
diff -purNX /tmp/kernel_exclude.txt ../linux-2.6.5.orig/arch/ppc64/kernel/signal32.c ./arch/ppc64/kernel/signal32.c
--- ../linux-2.6.5.orig/arch/ppc64/kernel/signal32.c	2004-09-25 13:38:38.000000000 +0000
+++ ./arch/ppc64/kernel/signal32.c	2004-09-25 17:15:43.164116677 +0000
@@ -24,6 +24,7 @@
 #include <linux/syscalls.h>
 #include <linux/errno.h>
 #include <linux/elf.h>
+#include <linux/olh.h>
 #include <linux/compat.h>
 #include <asm/ppc32.h>
 #include <asm/uaccess.h>
@@ -464,10 +465,25 @@ static long copy_siginfo_to_user32(compa
 				  &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:
+		{
+		int i;
+		unsigned char *p;
+		p=(unsigned char*)d;
+		olh("si_ptr %p s%u d%u d 0x%p p 0x%p",s->si_ptr,offsetof(siginfo_t,si_ptr),offsetof(compat_siginfo_t,si_ptr),d,p);
+		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);
+		for(i=0;i<(8*sizeof(int));i=i+4)printk("%02x%02x%02x%02x ",p[i],p[i+1],p[i+2],p[i+3]);
+		printk("\n");
+		p=(unsigned char*)s;
+		for(i=0;i<(12*sizeof(int));i=i+4)printk("%02x%02x%02x%02x ",p[i],p[i+1],p[i+2],p[i+3]);
+		printk("\n");
+		break;
+		}
 	case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
 /*	case __SI_MESGQ >> 16: */
 		err |= __put_user(s->si_int, &d->si_int);
diff -purNX /tmp/kernel_exclude.txt ../linux-2.6.5.orig/include/asm-ppc64/ppc32.h ./include/asm-ppc64/ppc32.h
--- ../linux-2.6.5.orig/include/asm-ppc64/ppc32.h	2004-04-04 03:36:57.000000000 +0000
+++ ./include/asm-ppc64/ppc32.h	2004-09-25 14:55:56.110531545 +0000
@@ -56,8 +56,10 @@ typedef struct compat_siginfo {
 
 		/* 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 */
diff -purNX /tmp/kernel_exclude.txt ../linux-2.6.5.orig/include/linux/olh.h ./include/linux/olh.h
--- ../linux-2.6.5.orig/include/linux/olh.h	1970-01-01 00:00:00.000000000 +0000
+++ ./include/linux/olh.h	2004-09-25 13:54:22.548576332 +0000
@@ -0,0 +1,8 @@
+#ifndef __LINUX_OLH_H
+#define __LINUX_OLH_H
+#define tolh(fmt) \
+	printk(KERN_DEBUG "%s(%u) %s(%u):c%u,j%lu " fmt "\n",__FUNCTION__,__LINE__,current->comm,current->pid,smp_processor_id(),jiffies)
+#define olh(fmt,args ...) \
+	printk(KERN_DEBUG "%s(%u) %s(%u):c%u,j%lu " fmt "\n",__FUNCTION__,__LINE__,current->comm,current->pid,smp_processor_id(),jiffies,args)
+#endif
+
-- 
USB is for mice, FireWire is for men!

sUse lINUX ag, nÜRNBERG



More information about the Linuxppc64-dev mailing list