aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Rothwell <sfr@canb.auug.org.au>2005-09-06 18:16:40 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-07 19:57:19 -0400
commit202e5979af4d91c7ca05892641131dee22653259 (patch)
treeba8443571add62bc93d29c1f6a3575381cccd167
parent8dbfc5cfdcac04d656f6f6789eb8fcdcc3d2dfda (diff)
[PATCH] compat: be more consistent about [ug]id_t
When I first wrote the compat layer patches, I was somewhat cavalier about the definition of compat_uid_t and compat_gid_t (or maybe I just misunderstood :-)). This patch makes the compat types much more consistent with the types we are being compatible with and hopefully will fix a few bugs along the way. compat type type in compat arch __compat_[ug]id_t __kernel_[ug]id_t __compat_[ug]id32_t __kernel_[ug]id32_t compat_[ug]id_t [ug]id_t The difference is that compat_uid_t is always 32 bits (for the archs we care about) but __compat_uid_t may be 16 bits on some. Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--arch/mips/kernel/linux32.c16
-rw-r--r--fs/compat.c16
-rw-r--r--include/asm-ia64/compat.h20
-rw-r--r--include/asm-mips/compat.h10
-rw-r--r--include/asm-parisc/compat.h10
-rw-r--r--include/asm-ppc64/compat.h18
-rw-r--r--include/asm-s390/compat.h20
-rw-r--r--include/asm-sparc64/compat.h18
-rw-r--r--include/asm-x86_64/compat.h20
-rw-r--r--include/linux/compat.h3
-rw-r--r--ipc/compat.c12
11 files changed, 87 insertions, 76 deletions
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 4613219dd73e..ece4564919d8 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -546,20 +546,20 @@ struct msgbuf32 { s32 mtype; char mtext[1]; };
546struct ipc_perm32 546struct ipc_perm32
547{ 547{
548 key_t key; 548 key_t key;
549 compat_uid_t uid; 549 __compat_uid_t uid;
550 compat_gid_t gid; 550 __compat_gid_t gid;
551 compat_uid_t cuid; 551 __compat_uid_t cuid;
552 compat_gid_t cgid; 552 __compat_gid_t cgid;
553 compat_mode_t mode; 553 compat_mode_t mode;
554 unsigned short seq; 554 unsigned short seq;
555}; 555};
556 556
557struct ipc64_perm32 { 557struct ipc64_perm32 {
558 key_t key; 558 key_t key;
559 compat_uid_t uid; 559 __compat_uid_t uid;
560 compat_gid_t gid; 560 __compat_gid_t gid;
561 compat_uid_t cuid; 561 __compat_uid_t cuid;
562 compat_gid_t cgid; 562 __compat_gid_t cgid;
563 compat_mode_t mode; 563 compat_mode_t mode;
564 unsigned short seq; 564 unsigned short seq;
565 unsigned short __pad1; 565 unsigned short __pad1;
diff --git a/fs/compat.c b/fs/compat.c
index 6b06b6bae35e..8e03d31eec3b 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -720,14 +720,14 @@ compat_sys_io_submit(aio_context_t ctx_id, int nr, u32 __user *iocb)
720struct compat_ncp_mount_data { 720struct compat_ncp_mount_data {
721 compat_int_t version; 721 compat_int_t version;
722 compat_uint_t ncp_fd; 722 compat_uint_t ncp_fd;
723 compat_uid_t mounted_uid; 723 __compat_uid_t mounted_uid;
724 compat_pid_t wdog_pid; 724 compat_pid_t wdog_pid;
725 unsigned char mounted_vol[NCP_VOLNAME_LEN + 1]; 725 unsigned char mounted_vol[NCP_VOLNAME_LEN + 1];
726 compat_uint_t time_out; 726 compat_uint_t time_out;
727 compat_uint_t retry_count; 727 compat_uint_t retry_count;
728 compat_uint_t flags; 728 compat_uint_t flags;
729 compat_uid_t uid; 729 __compat_uid_t uid;
730 compat_gid_t gid; 730 __compat_gid_t gid;
731 compat_mode_t file_mode; 731 compat_mode_t file_mode;
732 compat_mode_t dir_mode; 732 compat_mode_t dir_mode;
733}; 733};
@@ -784,9 +784,9 @@ static void *do_ncp_super_data_conv(void *raw_data)
784 784
785struct compat_smb_mount_data { 785struct compat_smb_mount_data {
786 compat_int_t version; 786 compat_int_t version;
787 compat_uid_t mounted_uid; 787 __compat_uid_t mounted_uid;
788 compat_uid_t uid; 788 __compat_uid_t uid;
789 compat_gid_t gid; 789 __compat_gid_t gid;
790 compat_mode_t file_mode; 790 compat_mode_t file_mode;
791 compat_mode_t dir_mode; 791 compat_mode_t dir_mode;
792}; 792};
@@ -1808,8 +1808,8 @@ struct compat_nfsctl_export {
1808 compat_dev_t ex32_dev; 1808 compat_dev_t ex32_dev;
1809 compat_ino_t ex32_ino; 1809 compat_ino_t ex32_ino;
1810 compat_int_t ex32_flags; 1810 compat_int_t ex32_flags;
1811 compat_uid_t ex32_anon_uid; 1811 __compat_uid_t ex32_anon_uid;
1812 compat_gid_t ex32_anon_gid; 1812 __compat_gid_t ex32_anon_gid;
1813}; 1813};
1814 1814
1815struct compat_nfsctl_fdparm { 1815struct compat_nfsctl_fdparm {
diff --git a/include/asm-ia64/compat.h b/include/asm-ia64/compat.h
index 0c05e5bad8a0..aaf11f4e9169 100644
--- a/include/asm-ia64/compat.h
+++ b/include/asm-ia64/compat.h
@@ -13,10 +13,10 @@ typedef s32 compat_time_t;
13typedef s32 compat_clock_t; 13typedef s32 compat_clock_t;
14typedef s32 compat_key_t; 14typedef s32 compat_key_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u16 compat_uid_t; 16typedef u16 __compat_uid_t;
17typedef u16 compat_gid_t; 17typedef u16 __compat_gid_t;
18typedef u32 compat_uid32_t; 18typedef u32 __compat_uid32_t;
19typedef u32 compat_gid32_t; 19typedef u32 __compat_gid32_t;
20typedef u16 compat_mode_t; 20typedef u16 compat_mode_t;
21typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
22typedef u16 compat_dev_t; 22typedef u16 compat_dev_t;
@@ -50,8 +50,8 @@ struct compat_stat {
50 compat_ino_t st_ino; 50 compat_ino_t st_ino;
51 compat_mode_t st_mode; 51 compat_mode_t st_mode;
52 compat_nlink_t st_nlink; 52 compat_nlink_t st_nlink;
53 compat_uid_t st_uid; 53 __compat_uid_t st_uid;
54 compat_gid_t st_gid; 54 __compat_gid_t st_gid;
55 compat_dev_t st_rdev; 55 compat_dev_t st_rdev;
56 u16 __pad2; 56 u16 __pad2;
57 u32 st_size; 57 u32 st_size;
@@ -120,10 +120,10 @@ typedef u32 compat_sigset_word;
120 120
121struct compat_ipc64_perm { 121struct compat_ipc64_perm {
122 compat_key_t key; 122 compat_key_t key;
123 compat_uid32_t uid; 123 __compat_uid32_t uid;
124 compat_gid32_t gid; 124 __compat_gid32_t gid;
125 compat_uid32_t cuid; 125 __compat_uid32_t cuid;
126 compat_gid32_t cgid; 126 __compat_gid32_t cgid;
127 unsigned short mode; 127 unsigned short mode;
128 unsigned short __pad1; 128 unsigned short __pad1;
129 unsigned short seq; 129 unsigned short seq;
diff --git a/include/asm-mips/compat.h b/include/asm-mips/compat.h
index d78002afb1e1..2c084cd4bc0a 100644
--- a/include/asm-mips/compat.h
+++ b/include/asm-mips/compat.h
@@ -15,8 +15,10 @@ typedef s32 compat_clock_t;
15typedef s32 compat_suseconds_t; 15typedef s32 compat_suseconds_t;
16 16
17typedef s32 compat_pid_t; 17typedef s32 compat_pid_t;
18typedef s32 compat_uid_t; 18typedef u32 __compat_uid_t;
19typedef s32 compat_gid_t; 19typedef u32 __compat_gid_t;
20typedef u32 __compat_uid32_t;
21typedef u32 __compat_gid32_t;
20typedef u32 compat_mode_t; 22typedef u32 compat_mode_t;
21typedef u32 compat_ino_t; 23typedef u32 compat_ino_t;
22typedef u32 compat_dev_t; 24typedef u32 compat_dev_t;
@@ -52,8 +54,8 @@ struct compat_stat {
52 compat_ino_t st_ino; 54 compat_ino_t st_ino;
53 compat_mode_t st_mode; 55 compat_mode_t st_mode;
54 compat_nlink_t st_nlink; 56 compat_nlink_t st_nlink;
55 compat_uid_t st_uid; 57 __compat_uid32_t st_uid;
56 compat_gid_t st_gid; 58 __compat_gid32_t st_gid;
57 compat_dev_t st_rdev; 59 compat_dev_t st_rdev;
58 s32 st_pad2[2]; 60 s32 st_pad2[2];
59 compat_off_t st_size; 61 compat_off_t st_size;
diff --git a/include/asm-parisc/compat.h b/include/asm-parisc/compat.h
index 7630d1ad2391..38b918feead9 100644
--- a/include/asm-parisc/compat.h
+++ b/include/asm-parisc/compat.h
@@ -13,8 +13,10 @@ typedef s32 compat_ssize_t;
13typedef s32 compat_time_t; 13typedef s32 compat_time_t;
14typedef s32 compat_clock_t; 14typedef s32 compat_clock_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u32 compat_uid_t; 16typedef u32 __compat_uid_t;
17typedef u32 compat_gid_t; 17typedef u32 __compat_gid_t;
18typedef u32 __compat_uid32_t;
19typedef u32 __compat_gid32_t;
18typedef u16 compat_mode_t; 20typedef u16 compat_mode_t;
19typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
20typedef u32 compat_dev_t; 22typedef u32 compat_dev_t;
@@ -67,8 +69,8 @@ struct compat_stat {
67 compat_dev_t st_realdev; 69 compat_dev_t st_realdev;
68 u16 st_basemode; 70 u16 st_basemode;
69 u16 st_spareshort; 71 u16 st_spareshort;
70 compat_uid_t st_uid; 72 __compat_uid32_t st_uid;
71 compat_gid_t st_gid; 73 __compat_gid32_t st_gid;
72 u32 st_spare4[3]; 74 u32 st_spare4[3];
73}; 75};
74 76
diff --git a/include/asm-ppc64/compat.h b/include/asm-ppc64/compat.h
index 12414f5fc666..6ec62cd2d1d1 100644
--- a/include/asm-ppc64/compat.h
+++ b/include/asm-ppc64/compat.h
@@ -13,8 +13,10 @@ typedef s32 compat_ssize_t;
13typedef s32 compat_time_t; 13typedef s32 compat_time_t;
14typedef s32 compat_clock_t; 14typedef s32 compat_clock_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u32 compat_uid_t; 16typedef u32 __compat_uid_t;
17typedef u32 compat_gid_t; 17typedef u32 __compat_gid_t;
18typedef u32 __compat_uid32_t;
19typedef u32 __compat_gid32_t;
18typedef u32 compat_mode_t; 20typedef u32 compat_mode_t;
19typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
20typedef u32 compat_dev_t; 22typedef u32 compat_dev_t;
@@ -48,8 +50,8 @@ struct compat_stat {
48 compat_ino_t st_ino; 50 compat_ino_t st_ino;
49 compat_mode_t st_mode; 51 compat_mode_t st_mode;
50 compat_nlink_t st_nlink; 52 compat_nlink_t st_nlink;
51 compat_uid_t st_uid; 53 __compat_uid32_t st_uid;
52 compat_gid_t st_gid; 54 __compat_gid32_t st_gid;
53 compat_dev_t st_rdev; 55 compat_dev_t st_rdev;
54 compat_off_t st_size; 56 compat_off_t st_size;
55 compat_off_t st_blksize; 57 compat_off_t st_blksize;
@@ -144,10 +146,10 @@ static inline void __user *compat_alloc_user_space(long len)
144 */ 146 */
145struct compat_ipc64_perm { 147struct compat_ipc64_perm {
146 compat_key_t key; 148 compat_key_t key;
147 compat_uid_t uid; 149 __compat_uid_t uid;
148 compat_gid_t gid; 150 __compat_gid_t gid;
149 compat_uid_t cuid; 151 __compat_uid_t cuid;
150 compat_gid_t cgid; 152 __compat_gid_t cgid;
151 compat_mode_t mode; 153 compat_mode_t mode;
152 unsigned int seq; 154 unsigned int seq;
153 unsigned int __pad2; 155 unsigned int __pad2;
diff --git a/include/asm-s390/compat.h b/include/asm-s390/compat.h
index 7f8f544eb262..a007715f4aea 100644
--- a/include/asm-s390/compat.h
+++ b/include/asm-s390/compat.h
@@ -13,10 +13,10 @@ typedef s32 compat_ssize_t;
13typedef s32 compat_time_t; 13typedef s32 compat_time_t;
14typedef s32 compat_clock_t; 14typedef s32 compat_clock_t;
15typedef s32 compat_pid_t; 15typedef s32 compat_pid_t;
16typedef u16 compat_uid_t; 16typedef u16 __compat_uid_t;
17typedef u16 compat_gid_t; 17typedef u16 __compat_gid_t;
18typedef u32 compat_uid32_t; 18typedef u32 __compat_uid32_t;
19typedef u32 compat_gid32_t; 19typedef u32 __compat_gid32_t;
20typedef u16 compat_mode_t; 20typedef u16 compat_mode_t;
21typedef u32 compat_ino_t; 21typedef u32 compat_ino_t;
22typedef u16 compat_dev_t; 22typedef u16 compat_dev_t;
@@ -51,8 +51,8 @@ struct compat_stat {
51 compat_ino_t st_ino; 51 compat_ino_t st_ino;
52 compat_mode_t st_mode; 52 compat_mode_t st_mode;
53 compat_nlink_t st_nlink; 53 compat_nlink_t st_nlink;
54 compat_uid_t st_uid; 54 __compat_uid_t st_uid;
55 compat_gid_t st_gid; 55 __compat_gid_t st_gid;
56 compat_dev_t st_rdev; 56 compat_dev_t st_rdev;
57 u16 __pad2; 57 u16 __pad2;
58 u32 st_size; 58 u32 st_size;
@@ -140,10 +140,10 @@ static inline void __user *compat_alloc_user_space(long len)
140 140
141struct compat_ipc64_perm { 141struct compat_ipc64_perm {
142 compat_key_t key; 142 compat_key_t key;
143 compat_uid32_t uid; 143 __compat_uid32_t uid;
144 compat_gid32_t gid; 144 __compat_gid32_t gid;
145 compat_uid32_t cuid; 145 __compat_uid32_t cuid;
146 compat_gid32_t cgid; 146 __compat_gid32_t cgid;
147 compat_mode_t mode; 147 compat_mode_t mode;
148 unsigned short __pad1; 148 unsigned short __pad1;
149 unsigned short seq; 149 unsigned short seq;
diff --git a/include/asm-sparc64/compat.h b/include/asm-sparc64/compat.h
index b59122dd176d..c73935dc7ba1 100644
--- a/include/asm-sparc64/compat.h
+++ b/include/asm-sparc64/compat.h
@@ -12,8 +12,10 @@ typedef s32 compat_ssize_t;
12typedef s32 compat_time_t; 12typedef s32 compat_time_t;
13typedef s32 compat_clock_t; 13typedef s32 compat_clock_t;
14typedef s32 compat_pid_t; 14typedef s32 compat_pid_t;
15typedef u16 compat_uid_t; 15typedef u16 __compat_uid_t;
16typedef u16 compat_gid_t; 16typedef u16 __compat_gid_t;
17typedef u32 __compat_uid32_t;
18typedef u32 __compat_gid32_t;
17typedef u16 compat_mode_t; 19typedef u16 compat_mode_t;
18typedef u32 compat_ino_t; 20typedef u32 compat_ino_t;
19typedef u16 compat_dev_t; 21typedef u16 compat_dev_t;
@@ -47,8 +49,8 @@ struct compat_stat {
47 compat_ino_t st_ino; 49 compat_ino_t st_ino;
48 compat_mode_t st_mode; 50 compat_mode_t st_mode;
49 compat_nlink_t st_nlink; 51 compat_nlink_t st_nlink;
50 compat_uid_t st_uid; 52 __compat_uid_t st_uid;
51 compat_gid_t st_gid; 53 __compat_gid_t st_gid;
52 compat_dev_t st_rdev; 54 compat_dev_t st_rdev;
53 compat_off_t st_size; 55 compat_off_t st_size;
54 compat_time_t st_atime; 56 compat_time_t st_atime;
@@ -177,10 +179,10 @@ static __inline__ void __user *compat_alloc_user_space(long len)
177 179
178struct compat_ipc64_perm { 180struct compat_ipc64_perm {
179 compat_key_t key; 181 compat_key_t key;
180 __kernel_uid_t uid; 182 __compat_uid32_t uid;
181 __kernel_gid_t gid; 183 __compat_gid32_t gid;
182 __kernel_uid_t cuid; 184 __compat_uid32_t cuid;
183 __kernel_gid_t cgid; 185 __compat_gid32_t cgid;
184 unsigned short __pad1; 186 unsigned short __pad1;
185 compat_mode_t mode; 187 compat_mode_t mode;
186 unsigned short __pad2; 188 unsigned short __pad2;
diff --git a/include/asm-x86_64/compat.h b/include/asm-x86_64/compat.h
index d0f453c5adfc..f0155c38f639 100644
--- a/include/asm-x86_64/compat.h
+++ b/include/asm-x86_64/compat.h
@@ -14,10 +14,10 @@ typedef s32 compat_ssize_t;
14typedef s32 compat_time_t; 14typedef s32 compat_time_t;
15typedef s32 compat_clock_t; 15typedef s32 compat_clock_t;
16typedef s32 compat_pid_t; 16typedef s32 compat_pid_t;
17typedef u16 compat_uid_t; 17typedef u16 __compat_uid_t;
18typedef u16 compat_gid_t; 18typedef u16 __compat_gid_t;
19typedef u32 compat_uid32_t; 19typedef u32 __compat_uid32_t;
20typedef u32 compat_gid32_t; 20typedef u32 __compat_gid32_t;
21typedef u16 compat_mode_t; 21typedef u16 compat_mode_t;
22typedef u32 compat_ino_t; 22typedef u32 compat_ino_t;
23typedef u16 compat_dev_t; 23typedef u16 compat_dev_t;
@@ -52,8 +52,8 @@ struct compat_stat {
52 compat_ino_t st_ino; 52 compat_ino_t st_ino;
53 compat_mode_t st_mode; 53 compat_mode_t st_mode;
54 compat_nlink_t st_nlink; 54 compat_nlink_t st_nlink;
55 compat_uid_t st_uid; 55 __compat_uid_t st_uid;
56 compat_gid_t st_gid; 56 __compat_gid_t st_gid;
57 compat_dev_t st_rdev; 57 compat_dev_t st_rdev;
58 u16 __pad2; 58 u16 __pad2;
59 u32 st_size; 59 u32 st_size;
@@ -122,10 +122,10 @@ typedef u32 compat_sigset_word;
122 122
123struct compat_ipc64_perm { 123struct compat_ipc64_perm {
124 compat_key_t key; 124 compat_key_t key;
125 compat_uid32_t uid; 125 __compat_uid32_t uid;
126 compat_gid32_t gid; 126 __compat_gid32_t gid;
127 compat_uid32_t cuid; 127 __compat_uid32_t cuid;
128 compat_gid32_t cgid; 128 __compat_gid32_t cgid;
129 unsigned short mode; 129 unsigned short mode;
130 unsigned short __pad1; 130 unsigned short __pad1;
131 unsigned short seq; 131 unsigned short seq;
diff --git a/include/linux/compat.h b/include/linux/compat.h
index b58b7d6f2fdb..f9ca534787e2 100644
--- a/include/linux/compat.h
+++ b/include/linux/compat.h
@@ -18,6 +18,9 @@
18#define compat_jiffies_to_clock_t(x) \ 18#define compat_jiffies_to_clock_t(x) \
19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ) 19 (((unsigned long)(x) * COMPAT_USER_HZ) / HZ)
20 20
21typedef __compat_uid32_t compat_uid_t;
22typedef __compat_gid32_t compat_gid_t;
23
21struct rusage; 24struct rusage;
22 25
23struct compat_itimerspec { 26struct compat_itimerspec {
diff --git a/ipc/compat.c b/ipc/compat.c
index 3881d564c668..1fe95f6659dd 100644
--- a/ipc/compat.c
+++ b/ipc/compat.c
@@ -42,10 +42,10 @@ struct compat_msgbuf {
42 42
43struct compat_ipc_perm { 43struct compat_ipc_perm {
44 key_t key; 44 key_t key;
45 compat_uid_t uid; 45 __compat_uid_t uid;
46 compat_gid_t gid; 46 __compat_gid_t gid;
47 compat_uid_t cuid; 47 __compat_uid_t cuid;
48 compat_gid_t cgid; 48 __compat_gid_t cgid;
49 compat_mode_t mode; 49 compat_mode_t mode;
50 unsigned short seq; 50 unsigned short seq;
51}; 51};
@@ -174,8 +174,8 @@ static inline int __put_compat_ipc_perm(struct ipc64_perm *p,
174 struct compat_ipc_perm __user *up) 174 struct compat_ipc_perm __user *up)
175{ 175{
176 int err; 176 int err;
177 compat_uid_t u; 177 __compat_uid_t u;
178 compat_gid_t g; 178 __compat_gid_t g;
179 179
180 err = __put_user(p->key, &up->key); 180 err = __put_user(p->key, &up->key);
181 SET_UID(u, p->uid); 181 SET_UID(u, p->uid);