Skip to contentSkip to conversation

IA-32 emulation patch: shmctl.patch

Linux-ia64 Arun Sharma 2 participants 2 messages May 23, 2003 – May 29, 2003

lore
Share & tools
lore
#0 lore raw

This one is similar to msgctl. We should be calling sys_shmctl with struct shmid64_ds.

In the absence of this patch:

shmctl(shmid, IPC_SET, &shmid_ds)

will fail.

-Arun

arch/ia64/ia32/sys_ia32.c +8 -8
diff -burN linux/arch/ia64/ia32/sys_ia32.c linux-changed/arch/ia64/ia32/sys_ia32.c
@@ -2408,7 +2408,7 @@
 shmctl32 (int first, int second, void *uptr)
 {
 	int err = -EFAULT, err2;
-	struct shmid_ds s;
+
 	struct shmid64_ds s64;
 	struct shmid_ds32 *up32 = (struct shmid_ds32 *)uptr;
 	struct shmid64_ds32 *up64 = (struct shmid64_ds32 *)uptr;
@@ -2460,19 +2460,19 @@
 
 	      case IPC_SET:
 		if (version = IPC_64) {
-			err = get_user(s.shm_perm.uid, &up64->shm_perm.uid);
-			err |= get_user(s.shm_perm.gid, &up64->shm_perm.gid);
-			err |= get_user(s.shm_perm.mode, &up64->shm_perm.mode);
+			err = get_user(s64.shm_perm.uid, &up64->shm_perm.uid);
+			err |= get_user(s64.shm_perm.gid, &up64->shm_perm.gid);
+			err |= get_user(s64.shm_perm.mode, &up64->shm_perm.mode);
 		} else {
-			err = get_user(s.shm_perm.uid, &up32->shm_perm.uid);
-			err |= get_user(s.shm_perm.gid, &up32->shm_perm.gid);
-			err |= get_user(s.shm_perm.mode, &up32->shm_perm.mode);
+			err = get_user(s64.shm_perm.uid, &up32->shm_perm.uid);
+			err |= get_user(s64.shm_perm.gid, &up32->shm_perm.gid);
+			err |= get_user(s64.shm_perm.mode, &up32->shm_perm.mode);
 		}
 		if (err)
 			break;
 		old_fs = get_fs();
 		set_fs(KERNEL_DS);
-		err = sys_shmctl(first, second, &s);
+		err = sys_shmctl(first, second, &s64);
 		set_fs(old_fs);
 		break;"
 
#1 lore raw
Quoted 8 lines · Arun Sharma

This one is similar to msgctl. We should be calling sys_shmctl with struct shmid64_ds.

In the absence of this patch:

shmctl(shmid, IPC_SET, &shmid_ds)

will fail.

I applied this for 2.4.