Subject: SysV IPC in mips64

From: Atsushi Nemoto <[email-masked]>
Date: Tue, 26 Aug 2003 21:06:12 +0900 (JST)

Some SysV IPC using old-style (without IPC_64 flag) does not work on
mips64 kernel.

I think SysV IPC conversion routine should set/clear IPC_64 flag when
calling native system-call routine if the conversion routine pass
their own data structures.

* should set IPC_64 for semid64_ds, msqid64_ds, shmid64_ds.
* should clear IPC_64 for shmid_ds.

Here is a patch against 2.4 tree.  This can be applied for 2.6 also.

diff -u linux-mips-cvs/arch/mips64/kernel/linux32.c linux/arch/mips64/kernel/linux32.c
--- linux-mips-cvs/arch/mips64/kernel/linux32.c	Tue Aug 26 20:49:10 2003
+++ linux/arch/mips64/kernel/linux32.c	Tue Aug 26 20:49:43 2003
@@ -1802,7 +1802,7 @@
 		fourth.__pad = &s;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_semctl (first, second, third, fourth);
+		err = sys_semctl (first, second, third | IPC_64, fourth);
 		set_fs (old_fs);
 
 		if (third & IPC_64) {
@@ -1967,7 +1967,7 @@
 			break;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, (struct msqid_ds *)&m);
+		err = sys_msgctl (first, second | IPC_64, (struct msqid_ds *)&m);
 		set_fs (old_fs);
 		break;
 
@@ -1975,7 +1975,7 @@
 	case MSG_STAT:
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_msgctl (first, second, (struct msqid_ds *)&m);
+		err = sys_msgctl (first, second | IPC_64, (struct msqid_ds *)&m);
 		set_fs (old_fs);
 		if (second & IPC_64) {
 			if (!access_ok(VERIFY_WRITE, up64, sizeof(*up64))) {
@@ -2084,7 +2084,7 @@
 			break;
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, &s);
+		err = sys_shmctl (first, second & ~IPC_64, &s);
 		set_fs (old_fs);
 		break;
 
@@ -2092,7 +2092,7 @@
 	case SHM_STAT:
 		old_fs = get_fs ();
 		set_fs (KERNEL_DS);
-		err = sys_shmctl (first, second, (void *) &s64);
+		err = sys_shmctl (first, second | IPC_64, (void *) &s64);
 		set_fs (old_fs);
 		if (err < 0)
 			break;
---
Atsushi Nemoto