Skip to contentSkip to conversation

sparc32: fix struct ipc64_perm type definition

PATCH In review Arnd Bergmann 3 participants 3 messages Jan 14, 2020 – Jan 21, 2020

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

PATCH 1/1 sparc32: fix struct ipc64_perm type definition

As discussed in the strace issue tracker, it appears that the sparc32 sysvipc support has been broken for the past 11 years. It was however working in compat mode, which is how it must have escaped most of the regular testing.

The problem is that a cleanup patch inadvertently changed the uid/gid fields in struct ipc64_perm from 32-bit types to 16-bit types in uapi headers.

Both glibc and uclibc-ng still use the original types, so they should work fine with compat mode, but not natively. Change the definitions to use __kernel_uid32_t and __kernel_gid32_t again.

Fixes 83c86984bff2 ("sparc: unify ipcbuf.h")
Cc <[email protected]> # v2.6.29
Cc Sam Ravnborg <[email protected]>
Cc "Dmitry V . Levin" <[email protected]>
Cc Rich Felker <[email protected]>
---
 arch/sparc/include/uapi/asm/ipcbuf.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/sparc/include/uapi/asm/ipcbuf.h +11 -11
index 5b933a598a33..0ea1240d2ea1 100644
@@ -17,19 +17,19 @@
 
 struct ipc64_perm
 {
-	__kernel_key_t	key;
-	__kernel_uid_t	uid;
-	__kernel_gid_t	gid;
-	__kernel_uid_t	cuid;
-	__kernel_gid_t	cgid;
+	__kernel_key_t		key;
+	__kernel_uid32_t	uid;
+	__kernel_gid32_t	gid;
+	__kernel_uid32_t	cuid;
+	__kernel_gid32_t	cgid;
 #ifndef __arch64__
-	unsigned short	__pad0;
+	unsigned short		__pad0;
 #endif
-	__kernel_mode_t	mode;
-	unsigned short	__pad1;
-	unsigned short	seq;
-	unsigned long long __unused1;
-	unsigned long long __unused2;
+	__kernel_mode_t		mode;
+	unsigned short		__pad1;
+	unsigned short		seq;
+	unsigned long long	__unused1;
+	unsigned long long	__unused2;
 };
 
 #endif /* __SPARC_IPCBUF_H */
Signature · 1 line
2.20.0
#1 lore raw
Quoted 50 lines · Arnd Bergmann

As discussed in the strace issue tracker, it appears that the sparc32 sysvipc support has been broken for the past 11 years. It was however working in compat mode, which is how it must have escaped most of the regular testing.

The problem is that a cleanup patch inadvertently changed the uid/gid fields in struct ipc64_perm from 32-bit types to 16-bit types in uapi headers.

Both glibc and uclibc-ng still use the original types, so they should work fine with compat mode, but not natively. Change the definitions to use __kernel_uid32_t and __kernel_gid32_t again.

Fixes 83c86984bff2 ("sparc: unify ipcbuf.h")
Cc <[email protected]> # v2.6.29
Cc Sam Ravnborg <[email protected]>
Cc "Dmitry V . Levin" <[email protected]>
Cc Rich Felker <[email protected]>
---
 arch/sparc/include/uapi/asm/ipcbuf.h | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
arch/sparc/include/uapi/asm/ipcbuf.h +6 -9
index 5b933a598a33..0ea1240d2ea1 100644
@@ -17,19 +17,19 @@
 
 struct ipc64_perm
 {
-	__kernel_key_t	key;
-	__kernel_uid_t	uid;
-	__kernel_gid_t	gid;
-	__kernel_uid_t	cuid;
-	__kernel_gid_t	cgid;
+	__kernel_key_t		key;
+	__kernel_uid32_t	uid;
+	__kernel_gid32_t	gid;
+	__kernel_uid32_t	cuid;
+	__kernel_gid32_t	cgid;
 #ifndef __arch64__
-	unsigned short	__pad0;
+	unsigned short		__pad0;
 #endif
-	__kernel_mode_t	mode;
-	unsigned short	__pad1;
-	unsigned short	seq;

arch/sparc/include/uapi/asm/ipcbuf.h line 35

Quoted 10 lines
arch/sparc/include/uapi/asm/ipcbuf.h +5 -2
-	unsigned long long __unused1;
-	unsigned long long __unused2;
+	__kernel_mode_t		mode;
+	unsigned short		__pad1;
+	unsigned short		seq;
+	unsigned long long	__unused1;
+	unsigned long long	__unused2;
 };
 
 #endif /* __SPARC_IPCBUF_H */

I think the fix is correct, I also confirm that the part of strace test suite that checks tracing of 32-bit tracees on sparc64 turns green again when this patch is applied.

Please add to the commit message that
this bug was found by strace test suite.

Feel free to add

Signature · 1 line
ldv
maintainer
#2 lore raw
In reply to Arnd Bergmann

From: Arnd Bergmann <[email protected]>
Date: Tue, 14 Jan 2020 14:26:14 +0100

Quoted 13 lines

As discussed in the strace issue tracker, it appears that the sparc32 sysvipc support has been broken for the past 11 years. It was however working in compat mode, which is how it must have escaped most of the regular testing.

The problem is that a cleanup patch inadvertently changed the uid/gid fields in struct ipc64_perm from 32-bit types to 16-bit types in uapi headers.

Both glibc and uclibc-ng still use the original types, so they should work fine with compat mode, but not natively. Change the definitions to use __kernel_uid32_t and __kernel_gid32_t again.

Quoted 8 lines
Fixes 83c86984bff2 ("sparc: unify ipcbuf.h")
Cc <[email protected]> # v2.6.29
Cc Sam Ravnborg <[email protected]>
Cc "Dmitry V . Levin" <[email protected]>
Cc Rich Felker <[email protected]>

Applied and queued up for -stable, thanks Arnd.