diff options
Diffstat (limited to 'kernel/uid16.c')
-rw-r--r-- | kernel/uid16.c | 70 |
1 files changed, 36 insertions, 34 deletions
diff --git a/kernel/uid16.c b/kernel/uid16.c index 3e41c1673e2f..0314501688b9 100644 --- a/kernel/uid16.c +++ b/kernel/uid16.c | |||
@@ -17,7 +17,7 @@ | |||
17 | 17 | ||
18 | #include <asm/uaccess.h> | 18 | #include <asm/uaccess.h> |
19 | 19 | ||
20 | asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gid_t group) | 20 | SYSCALL_DEFINE3(chown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) |
21 | { | 21 | { |
22 | long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); | 22 | long ret = sys_chown(filename, low2highuid(user), low2highgid(group)); |
23 | /* avoid REGPARM breakage on x86: */ | 23 | /* avoid REGPARM breakage on x86: */ |
@@ -25,7 +25,7 @@ asmlinkage long sys_chown16(const char __user * filename, old_uid_t user, old_gi | |||
25 | return ret; | 25 | return ret; |
26 | } | 26 | } |
27 | 27 | ||
28 | asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_gid_t group) | 28 | SYSCALL_DEFINE3(lchown16, const char __user *, filename, old_uid_t, user, old_gid_t, group) |
29 | { | 29 | { |
30 | long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); | 30 | long ret = sys_lchown(filename, low2highuid(user), low2highgid(group)); |
31 | /* avoid REGPARM breakage on x86: */ | 31 | /* avoid REGPARM breakage on x86: */ |
@@ -33,7 +33,7 @@ asmlinkage long sys_lchown16(const char __user * filename, old_uid_t user, old_g | |||
33 | return ret; | 33 | return ret; |
34 | } | 34 | } |
35 | 35 | ||
36 | asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) | 36 | SYSCALL_DEFINE3(fchown16, unsigned int, fd, old_uid_t, user, old_gid_t, group) |
37 | { | 37 | { |
38 | long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); | 38 | long ret = sys_fchown(fd, low2highuid(user), low2highgid(group)); |
39 | /* avoid REGPARM breakage on x86: */ | 39 | /* avoid REGPARM breakage on x86: */ |
@@ -41,7 +41,7 @@ asmlinkage long sys_fchown16(unsigned int fd, old_uid_t user, old_gid_t group) | |||
41 | return ret; | 41 | return ret; |
42 | } | 42 | } |
43 | 43 | ||
44 | asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) | 44 | SYSCALL_DEFINE2(setregid16, old_gid_t, rgid, old_gid_t, egid) |
45 | { | 45 | { |
46 | long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); | 46 | long ret = sys_setregid(low2highgid(rgid), low2highgid(egid)); |
47 | /* avoid REGPARM breakage on x86: */ | 47 | /* avoid REGPARM breakage on x86: */ |
@@ -49,7 +49,7 @@ asmlinkage long sys_setregid16(old_gid_t rgid, old_gid_t egid) | |||
49 | return ret; | 49 | return ret; |
50 | } | 50 | } |
51 | 51 | ||
52 | asmlinkage long sys_setgid16(old_gid_t gid) | 52 | SYSCALL_DEFINE1(setgid16, old_gid_t, gid) |
53 | { | 53 | { |
54 | long ret = sys_setgid(low2highgid(gid)); | 54 | long ret = sys_setgid(low2highgid(gid)); |
55 | /* avoid REGPARM breakage on x86: */ | 55 | /* avoid REGPARM breakage on x86: */ |
@@ -57,7 +57,7 @@ asmlinkage long sys_setgid16(old_gid_t gid) | |||
57 | return ret; | 57 | return ret; |
58 | } | 58 | } |
59 | 59 | ||
60 | asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) | 60 | SYSCALL_DEFINE2(setreuid16, old_uid_t, ruid, old_uid_t, euid) |
61 | { | 61 | { |
62 | long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); | 62 | long ret = sys_setreuid(low2highuid(ruid), low2highuid(euid)); |
63 | /* avoid REGPARM breakage on x86: */ | 63 | /* avoid REGPARM breakage on x86: */ |
@@ -65,7 +65,7 @@ asmlinkage long sys_setreuid16(old_uid_t ruid, old_uid_t euid) | |||
65 | return ret; | 65 | return ret; |
66 | } | 66 | } |
67 | 67 | ||
68 | asmlinkage long sys_setuid16(old_uid_t uid) | 68 | SYSCALL_DEFINE1(setuid16, old_uid_t, uid) |
69 | { | 69 | { |
70 | long ret = sys_setuid(low2highuid(uid)); | 70 | long ret = sys_setuid(low2highuid(uid)); |
71 | /* avoid REGPARM breakage on x86: */ | 71 | /* avoid REGPARM breakage on x86: */ |
@@ -73,7 +73,7 @@ asmlinkage long sys_setuid16(old_uid_t uid) | |||
73 | return ret; | 73 | return ret; |
74 | } | 74 | } |
75 | 75 | ||
76 | asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) | 76 | SYSCALL_DEFINE3(setresuid16, old_uid_t, ruid, old_uid_t, euid, old_uid_t, suid) |
77 | { | 77 | { |
78 | long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), | 78 | long ret = sys_setresuid(low2highuid(ruid), low2highuid(euid), |
79 | low2highuid(suid)); | 79 | low2highuid(suid)); |
@@ -82,18 +82,19 @@ asmlinkage long sys_setresuid16(old_uid_t ruid, old_uid_t euid, old_uid_t suid) | |||
82 | return ret; | 82 | return ret; |
83 | } | 83 | } |
84 | 84 | ||
85 | asmlinkage long sys_getresuid16(old_uid_t __user *ruid, old_uid_t __user *euid, old_uid_t __user *suid) | 85 | SYSCALL_DEFINE3(getresuid16, old_uid_t __user *, ruid, old_uid_t __user *, euid, old_uid_t __user *, suid) |
86 | { | 86 | { |
87 | const struct cred *cred = current_cred(); | ||
87 | int retval; | 88 | int retval; |
88 | 89 | ||
89 | if (!(retval = put_user(high2lowuid(current->uid), ruid)) && | 90 | if (!(retval = put_user(high2lowuid(cred->uid), ruid)) && |
90 | !(retval = put_user(high2lowuid(current->euid), euid))) | 91 | !(retval = put_user(high2lowuid(cred->euid), euid))) |
91 | retval = put_user(high2lowuid(current->suid), suid); | 92 | retval = put_user(high2lowuid(cred->suid), suid); |
92 | 93 | ||
93 | return retval; | 94 | return retval; |
94 | } | 95 | } |
95 | 96 | ||
96 | asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) | 97 | SYSCALL_DEFINE3(setresgid16, old_gid_t, rgid, old_gid_t, egid, old_gid_t, sgid) |
97 | { | 98 | { |
98 | long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), | 99 | long ret = sys_setresgid(low2highgid(rgid), low2highgid(egid), |
99 | low2highgid(sgid)); | 100 | low2highgid(sgid)); |
@@ -102,18 +103,20 @@ asmlinkage long sys_setresgid16(old_gid_t rgid, old_gid_t egid, old_gid_t sgid) | |||
102 | return ret; | 103 | return ret; |
103 | } | 104 | } |
104 | 105 | ||
105 | asmlinkage long sys_getresgid16(old_gid_t __user *rgid, old_gid_t __user *egid, old_gid_t __user *sgid) | 106 | |
107 | SYSCALL_DEFINE3(getresgid16, old_gid_t __user *, rgid, old_gid_t __user *, egid, old_gid_t __user *, sgid) | ||
106 | { | 108 | { |
109 | const struct cred *cred = current_cred(); | ||
107 | int retval; | 110 | int retval; |
108 | 111 | ||
109 | if (!(retval = put_user(high2lowgid(current->gid), rgid)) && | 112 | if (!(retval = put_user(high2lowgid(cred->gid), rgid)) && |
110 | !(retval = put_user(high2lowgid(current->egid), egid))) | 113 | !(retval = put_user(high2lowgid(cred->egid), egid))) |
111 | retval = put_user(high2lowgid(current->sgid), sgid); | 114 | retval = put_user(high2lowgid(cred->sgid), sgid); |
112 | 115 | ||
113 | return retval; | 116 | return retval; |
114 | } | 117 | } |
115 | 118 | ||
116 | asmlinkage long sys_setfsuid16(old_uid_t uid) | 119 | SYSCALL_DEFINE1(setfsuid16, old_uid_t, uid) |
117 | { | 120 | { |
118 | long ret = sys_setfsuid(low2highuid(uid)); | 121 | long ret = sys_setfsuid(low2highuid(uid)); |
119 | /* avoid REGPARM breakage on x86: */ | 122 | /* avoid REGPARM breakage on x86: */ |
@@ -121,7 +124,7 @@ asmlinkage long sys_setfsuid16(old_uid_t uid) | |||
121 | return ret; | 124 | return ret; |
122 | } | 125 | } |
123 | 126 | ||
124 | asmlinkage long sys_setfsgid16(old_gid_t gid) | 127 | SYSCALL_DEFINE1(setfsgid16, old_gid_t, gid) |
125 | { | 128 | { |
126 | long ret = sys_setfsgid(low2highgid(gid)); | 129 | long ret = sys_setfsgid(low2highgid(gid)); |
127 | /* avoid REGPARM breakage on x86: */ | 130 | /* avoid REGPARM breakage on x86: */ |
@@ -159,31 +162,30 @@ static int groups16_from_user(struct group_info *group_info, | |||
159 | return 0; | 162 | return 0; |
160 | } | 163 | } |
161 | 164 | ||
162 | asmlinkage long sys_getgroups16(int gidsetsize, old_gid_t __user *grouplist) | 165 | SYSCALL_DEFINE2(getgroups16, int, gidsetsize, old_gid_t __user *, grouplist) |
163 | { | 166 | { |
164 | int i = 0; | 167 | const struct cred *cred = current_cred(); |
168 | int i; | ||
165 | 169 | ||
166 | if (gidsetsize < 0) | 170 | if (gidsetsize < 0) |
167 | return -EINVAL; | 171 | return -EINVAL; |
168 | 172 | ||
169 | get_group_info(current->group_info); | 173 | i = cred->group_info->ngroups; |
170 | i = current->group_info->ngroups; | ||
171 | if (gidsetsize) { | 174 | if (gidsetsize) { |
172 | if (i > gidsetsize) { | 175 | if (i > gidsetsize) { |
173 | i = -EINVAL; | 176 | i = -EINVAL; |
174 | goto out; | 177 | goto out; |
175 | } | 178 | } |
176 | if (groups16_to_user(grouplist, current->group_info)) { | 179 | if (groups16_to_user(grouplist, cred->group_info)) { |
177 | i = -EFAULT; | 180 | i = -EFAULT; |
178 | goto out; | 181 | goto out; |
179 | } | 182 | } |
180 | } | 183 | } |
181 | out: | 184 | out: |
182 | put_group_info(current->group_info); | ||
183 | return i; | 185 | return i; |
184 | } | 186 | } |
185 | 187 | ||
186 | asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist) | 188 | SYSCALL_DEFINE2(setgroups16, int, gidsetsize, old_gid_t __user *, grouplist) |
187 | { | 189 | { |
188 | struct group_info *group_info; | 190 | struct group_info *group_info; |
189 | int retval; | 191 | int retval; |
@@ -208,22 +210,22 @@ asmlinkage long sys_setgroups16(int gidsetsize, old_gid_t __user *grouplist) | |||
208 | return retval; | 210 | return retval; |
209 | } | 211 | } |
210 | 212 | ||
211 | asmlinkage long sys_getuid16(void) | 213 | SYSCALL_DEFINE0(getuid16) |
212 | { | 214 | { |
213 | return high2lowuid(current->uid); | 215 | return high2lowuid(current_uid()); |
214 | } | 216 | } |
215 | 217 | ||
216 | asmlinkage long sys_geteuid16(void) | 218 | SYSCALL_DEFINE0(geteuid16) |
217 | { | 219 | { |
218 | return high2lowuid(current->euid); | 220 | return high2lowuid(current_euid()); |
219 | } | 221 | } |
220 | 222 | ||
221 | asmlinkage long sys_getgid16(void) | 223 | SYSCALL_DEFINE0(getgid16) |
222 | { | 224 | { |
223 | return high2lowgid(current->gid); | 225 | return high2lowgid(current_gid()); |
224 | } | 226 | } |
225 | 227 | ||
226 | asmlinkage long sys_getegid16(void) | 228 | SYSCALL_DEFINE0(getegid16) |
227 | { | 229 | { |
228 | return high2lowgid(current->egid); | 230 | return high2lowgid(current_egid()); |
229 | } | 231 | } |