lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1286388380-20646-2-git-send-email-arnd@arndb.de>
Date:	Wed,  6 Oct 2010 20:06:13 +0200
From:	Arnd Bergmann <arnd@...db.de>
To:	Russell King <linux@....linux.org.uk>, linux-kernel@...r.kernel.org
Cc:	Arnd Bergmann <arnd@...db.de>
Subject: [PATCH 1/8] arm: generalize IPC header files

The IPC structure definitions in ARM are all compatible
with the generic definitions. Make them look identical
as a preparation for actually using the files in
include/asm-generic.

Signed-off-by: Arnd Bergmann <arnd@...db.de>
---
 arch/arm/include/asm/ipcbuf.h |   15 ++++++++++-----
 arch/arm/include/asm/msgbuf.h |   20 ++++++++++++++++++--
 arch/arm/include/asm/sembuf.h |   27 ++++++++++++++++++++-------
 arch/arm/include/asm/shmbuf.h |   21 +++++++++++++++++++--
 4 files changed, 67 insertions(+), 16 deletions(-)

diff --git a/arch/arm/include/asm/ipcbuf.h b/arch/arm/include/asm/ipcbuf.h
index 9768397..40e492d 100644
--- a/arch/arm/include/asm/ipcbuf.h
+++ b/arch/arm/include/asm/ipcbuf.h
@@ -2,24 +2,29 @@
 #define __ASMARM_IPCBUF_H
 
 /*
- * The ipc64_perm structure for arm architecture.
+ * The generic ipc64_perm structure:
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * ipc64_perm was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
  * Pad space is left for:
- * - 32-bit mode_t and seq
+ * - 32-bit mode_t on architectures that only had 16 bit
+ * - 32-bit seq
  * - 2 miscellaneous 32-bit values
  */
 
-struct ipc64_perm
-{
+struct ipc64_perm {
 	__kernel_key_t		key;
 	__kernel_uid32_t	uid;
 	__kernel_gid32_t	gid;
 	__kernel_uid32_t	cuid;
 	__kernel_gid32_t	cgid;
 	__kernel_mode_t		mode;
-	unsigned short		__pad1;
+				/* pad if mode_t is u16: */
+	unsigned char		__pad1[4 - sizeof(__kernel_mode_t)];
 	unsigned short		seq;
 	unsigned short		__pad2;
 	unsigned long		__unused1;
diff --git a/arch/arm/include/asm/msgbuf.h b/arch/arm/include/asm/msgbuf.h
index 33b35b9..ca4e383 100644
--- a/arch/arm/include/asm/msgbuf.h
+++ b/arch/arm/include/asm/msgbuf.h
@@ -1,11 +1,21 @@
 #ifndef _ASMARM_MSGBUF_H
 #define _ASMARM_MSGBUF_H
 
-/* 
- * The msqid64_ds structure for arm architecture.
+#include <asm/bitsperlong.h>
+/*
+ * generic msqid64_ds structure.
+ *
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * msqid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures typically define a 64 bit __kernel_time_t,
+ * so they do not need the first three padding words.
+ * On big-endian systems, the padding is in the wrong place.
+ *
  * Pad space is left for:
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
@@ -14,11 +24,17 @@
 struct msqid64_ds {
 	struct ipc64_perm msg_perm;
 	__kernel_time_t msg_stime;	/* last msgsnd time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused1;
+#endif
 	__kernel_time_t msg_rtime;	/* last msgrcv time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused2;
+#endif
 	__kernel_time_t msg_ctime;	/* last change time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused3;
+#endif
 	unsigned long  msg_cbytes;	/* current number of bytes on queue */
 	unsigned long  msg_qnum;	/* number of messages in queue */
 	unsigned long  msg_qbytes;	/* max number of bytes on queue */
diff --git a/arch/arm/include/asm/sembuf.h b/arch/arm/include/asm/sembuf.h
index 1c02839..f7131b7 100644
--- a/arch/arm/include/asm/sembuf.h
+++ b/arch/arm/include/asm/sembuf.h
@@ -1,23 +1,36 @@
 #ifndef _ASMARM_SEMBUF_H
 #define _ASMARM_SEMBUF_H
 
-/* 
- * The semid64_ds structure for arm architecture.
+#include <asm/bitsperlong.h>
+
+/*
+ * The semid64_ds structure for x86 architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * semid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures typically define a 64 bit __kernel_time_t,
+ * so they do not need the first two padding words.
+ * On big-endian systems, the padding is in the wrong place.
+ *
  * Pad space is left for:
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
  */
-
 struct semid64_ds {
-	struct ipc64_perm sem_perm;		/* permissions .. see ipc.h */
-	__kernel_time_t	sem_otime;		/* last semop time */
+	struct ipc64_perm sem_perm;	/* permissions .. see ipc.h */
+	__kernel_time_t	sem_otime;	/* last semop time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused1;
-	__kernel_time_t	sem_ctime;		/* last change time */
+#endif
+	__kernel_time_t	sem_ctime;	/* last change time */
+#if __BITS_PER_LONG != 64
 	unsigned long	__unused2;
-	unsigned long	sem_nsems;		/* no. of semaphores in array */
+#endif
+	unsigned long	sem_nsems;	/* no. of semaphores in array */
 	unsigned long	__unused3;
 	unsigned long	__unused4;
 };
diff --git a/arch/arm/include/asm/shmbuf.h b/arch/arm/include/asm/shmbuf.h
index 2e5c67b..39b1ab0 100644
--- a/arch/arm/include/asm/shmbuf.h
+++ b/arch/arm/include/asm/shmbuf.h
@@ -1,11 +1,22 @@
 #ifndef _ASMARM_SHMBUF_H
 #define _ASMARM_SHMBUF_H
 
-/* 
- * The shmid64_ds structure for arm architecture.
+#include <asm/bitsperlong.h>
+
+/*
+ * The shmid64_ds structure for x86 architecture.
  * Note extra padding because this structure is passed back and forth
  * between kernel and user space.
  *
+ * shmid64_ds was originally meant to be architecture specific, but
+ * everyone just ended up making identical copies without specific
+ * optimizations, so we may just as well all use the same one.
+ *
+ * 64 bit architectures typically define a 64 bit __kernel_time_t,
+ * so they do not need the first two padding words.
+ * On big-endian systems, the padding is in the wrong place.
+ *
+ *
  * Pad space is left for:
  * - 64-bit time_t to solve y2038 problem
  * - 2 miscellaneous 32-bit values
@@ -15,11 +26,17 @@ struct shmid64_ds {
 	struct ipc64_perm	shm_perm;	/* operation perms */
 	size_t			shm_segsz;	/* size of segment (bytes) */
 	__kernel_time_t		shm_atime;	/* last attach time */
+#if __BITS_PER_LONG != 64
 	unsigned long		__unused1;
+#endif
 	__kernel_time_t		shm_dtime;	/* last detach time */
+#if __BITS_PER_LONG != 64
 	unsigned long		__unused2;
+#endif
 	__kernel_time_t		shm_ctime;	/* last change time */
+#if __BITS_PER_LONG != 64
 	unsigned long		__unused3;
+#endif
 	__kernel_pid_t		shm_cpid;	/* pid of creator */
 	__kernel_pid_t		shm_lpid;	/* pid of last operator */
 	unsigned long		shm_nattch;	/* no. of current attaches */
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ