Skip to contentSkip to conversation

Fix mq 32-bit compatibility

PATCH New Jakub Jelinek 1 participant 1 message Apr 15, 2004

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix mq 32-bit compatibility

Hi!

The first change removes just a useless put_user (si_int and si_ptr are part of the same union, si_ptr is on all arches covering whole union), the rest is fixes for signal handling of SI_MESGQ.

Tested on x86-64 with 32-bit glibc make check.
Please apply.

kernel/signal.c renamed from kernel/signal.c.jj +0 -1
@@ -2084,7 +2084,6 @@ int copy_siginfo_to_user(siginfo_t __use
 	case __SI_MESGQ: /* But this is */
 		err |= __put_user(from->si_pid, &to->si_pid);
 		err |= __put_user(from->si_uid, &to->si_uid);
-		err |= __put_user(from->si_int, &to->si_int);
 		err |= __put_user(from->si_ptr, &to->si_ptr);
 		break;
 	default: /* this is just in case for now ... */
include/asm-mips/siginfo.h renamed from include/asm-mips/siginfo.h.jj +1 -1
@@ -175,7 +175,7 @@ typedef struct siginfo32 {
 #undef SI_MESGQ
 #define SI_ASYNCIO	-2	/* sent by AIO completion */
 #define SI_TIMER __SI_CODE(__SI_TIMER,-3) /* sent by timer expiration */
-#define SI_MESGQ	-4	/* sent by real time mesq state change */
+#define SI_MESGQ __SI_CODE(__SI_MESGQ,-4) /* sent by real time mesq state change */
 
 #ifdef __KERNEL__
 
arch/sparc64/kernel/signal32.c renamed from arch/sparc64/kernel/signal32.c.jj +2 -2
@@ -129,8 +129,8 @@ int copy_siginfo_to_user32(siginfo_t32 _
 			err |= __put_user(from->si_trapno, &to->si_trapno);
 			err |= __put_user((long)from->si_addr, &to->si_addr);
 			break;
-		case __SI_RT: /* This is not generated by the kernel as of now.  */
-		case __SI_MESGQ:
+		case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
+		case __SI_MESGQ >> 16:
 			err |= __put_user(from->si_pid, &to->si_pid);
 			err |= __put_user(from->si_uid, &to->si_uid);
 			err |= __put_user(from->si_int, &to->si_int);
arch/s390/kernel/compat_signal.c renamed from arch/s390/kernel/compat_signal.c.jj +2 -2
@@ -74,8 +74,8 @@ int copy_siginfo_to_user32(siginfo_t32 *
 		err |= __copy_to_user(&to->_sifields._pad, &from->_sifields._pad, SI_PAD_SIZE);
 	else {
 		switch (from->si_code >> 16) {
-		case __SI_RT: /* This is not generated by the kernel as of now.  */
-		case __SI_MESGQ:
+		case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
+		case __SI_MESGQ >> 16:
 			err |= __put_user(from->si_int, &to->si_int);
 			/* fallthrough */
 		case __SI_KILL >> 16:
arch/mips/kernel/signal32.c renamed from arch/mips/kernel/signal32.c.jj +2 -2
@@ -358,8 +358,8 @@ static int copy_siginfo_to_user32(siginf
 			err |= __put_user(from->si_band, &to->si_band);
 			err |= __put_user(from->si_fd, &to->si_fd);
 			break;
-		case __SI_RT: /* This is not generated by the kernel as of now.  */
-		case __SI_MESGQ:
+		case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
+		case __SI_MESGQ >> 16:
 			err |= __put_user(from->si_pid, &to->si_pid);
 			err |= __put_user(from->si_uid, &to->si_uid);
 			err |= __put_user(from->si_int, &to->si_int);
arch/ia64/ia32/ia32_signal.c renamed from arch/ia64/ia32/ia32_signal.c.jj +2 -2
@@ -114,8 +114,8 @@ copy_siginfo_from_user32 (siginfo_t *to,
 			err |= __get_user(to->si_band, &from->si_band);
 			err |= __get_user(to->si_fd, &from->si_fd);
 			break;
-		      case __SI_RT: /* This is not generated by the kernel as of now.  */
-		      case __SI_MESGQ:
+		      case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
+		      case __SI_MESGQ >> 16:
 			err |= __get_user(to->si_pid, &from->si_pid);
 			err |= __get_user(to->si_uid, &from->si_uid);
 			err |= __get_user(to->si_int, &from->si_int);
arch/x86_64/ia32/ia32_signal.c renamed from arch/x86_64/ia32/ia32_signal.c.jj +2 -2
@@ -85,8 +85,8 @@ int ia32_copy_siginfo_to_user(siginfo_t3
 			err |= __put_user(from->si_overrun, &to->si_overrun); 
 			err |= __put_user((u32)(u64)from->si_ptr, &to->si_ptr);
 			break;
-		case __SI_RT: /* This is not generated by the kernel as of now.  */
-		case __SI_MESGQ:
+		case __SI_RT >> 16: /* This is not generated by the kernel as of now.  */
+		case __SI_MESGQ >> 16:
 			err |= __put_user(from->si_uid, &to->si_uid);
 			err |= __put_user(from->si_int, &to->si_int);
 			break;

Jakub