diff options
author | David Howells <dhowells@redhat.com> | 2008-11-13 18:39:16 -0500 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2008-11-13 18:39:16 -0500 |
commit | b6dff3ec5e116e3af6f537d4caedcad6b9e5082a (patch) | |
tree | 9e76f972eb7ce9b84e0146c8e4126a3f86acb428 /arch | |
parent | 15a2460ed0af7538ca8e6c610fe607a2cd9da142 (diff) |
CRED: Separate task security context from task_struct
Separate the task security context from task_struct. At this point, the
security data is temporarily embedded in the task_struct with two pointers
pointing to it.
Note that the Alpha arch is altered as it refers to (E)UID and (E)GID in
entry.S via asm-offsets.
With comment fixes Signed-off-by: Marc Dionne <marc.c.dionne@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Acked-by: James Morris <jmorris@namei.org>
Acked-by: Serge Hallyn <serue@us.ibm.com>
Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/alpha/kernel/asm-offsets.c | 11 | ||||
-rw-r--r-- | arch/alpha/kernel/entry.S | 10 | ||||
-rw-r--r-- | arch/ia64/ia32/sys_ia32.c | 8 | ||||
-rw-r--r-- | arch/mips/kernel/kspd.c | 4 | ||||
-rw-r--r-- | arch/s390/kernel/compat_linux.c | 28 |
5 files changed, 33 insertions, 28 deletions
diff --git a/arch/alpha/kernel/asm-offsets.c b/arch/alpha/kernel/asm-offsets.c index 4b18cd94d59d..6ff8886e7e22 100644 --- a/arch/alpha/kernel/asm-offsets.c +++ b/arch/alpha/kernel/asm-offsets.c | |||
@@ -19,15 +19,18 @@ void foo(void) | |||
19 | BLANK(); | 19 | BLANK(); |
20 | 20 | ||
21 | DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked)); | 21 | DEFINE(TASK_BLOCKED, offsetof(struct task_struct, blocked)); |
22 | DEFINE(TASK_UID, offsetof(struct task_struct, uid)); | 22 | DEFINE(TASK_CRED, offsetof(struct task_struct, cred)); |
23 | DEFINE(TASK_EUID, offsetof(struct task_struct, euid)); | ||
24 | DEFINE(TASK_GID, offsetof(struct task_struct, gid)); | ||
25 | DEFINE(TASK_EGID, offsetof(struct task_struct, egid)); | ||
26 | DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent)); | 23 | DEFINE(TASK_REAL_PARENT, offsetof(struct task_struct, real_parent)); |
27 | DEFINE(TASK_GROUP_LEADER, offsetof(struct task_struct, group_leader)); | 24 | DEFINE(TASK_GROUP_LEADER, offsetof(struct task_struct, group_leader)); |
28 | DEFINE(TASK_TGID, offsetof(struct task_struct, tgid)); | 25 | DEFINE(TASK_TGID, offsetof(struct task_struct, tgid)); |
29 | BLANK(); | 26 | BLANK(); |
30 | 27 | ||
28 | DEFINE(CRED_UID, offsetof(struct cred, uid)); | ||
29 | DEFINE(CRED_EUID, offsetof(struct cred, euid)); | ||
30 | DEFINE(CRED_GID, offsetof(struct cred, gid)); | ||
31 | DEFINE(CRED_EGID, offsetof(struct cred, egid)); | ||
32 | BLANK(); | ||
33 | |||
31 | DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs)); | 34 | DEFINE(SIZEOF_PT_REGS, sizeof(struct pt_regs)); |
32 | DEFINE(PT_PTRACED, PT_PTRACED); | 35 | DEFINE(PT_PTRACED, PT_PTRACED); |
33 | DEFINE(CLONE_VM, CLONE_VM); | 36 | DEFINE(CLONE_VM, CLONE_VM); |
diff --git a/arch/alpha/kernel/entry.S b/arch/alpha/kernel/entry.S index 5fc61e281ac7..f77345bc66a9 100644 --- a/arch/alpha/kernel/entry.S +++ b/arch/alpha/kernel/entry.S | |||
@@ -850,8 +850,9 @@ osf_getpriority: | |||
850 | sys_getxuid: | 850 | sys_getxuid: |
851 | .prologue 0 | 851 | .prologue 0 |
852 | ldq $2, TI_TASK($8) | 852 | ldq $2, TI_TASK($8) |
853 | ldl $0, TASK_UID($2) | 853 | ldq $3, TASK_CRED($2) |
854 | ldl $1, TASK_EUID($2) | 854 | ldl $0, CRED_UID($3) |
855 | ldl $1, CRED_EUID($3) | ||
855 | stq $1, 80($sp) | 856 | stq $1, 80($sp) |
856 | ret | 857 | ret |
857 | .end sys_getxuid | 858 | .end sys_getxuid |
@@ -862,8 +863,9 @@ sys_getxuid: | |||
862 | sys_getxgid: | 863 | sys_getxgid: |
863 | .prologue 0 | 864 | .prologue 0 |
864 | ldq $2, TI_TASK($8) | 865 | ldq $2, TI_TASK($8) |
865 | ldl $0, TASK_GID($2) | 866 | ldq $3, TASK_CRED($2) |
866 | ldl $1, TASK_EGID($2) | 867 | ldl $0, CRED_GID($3) |
868 | ldl $1, CRED_EGID($3) | ||
867 | stq $1, 80($sp) | 869 | stq $1, 80($sp) |
868 | ret | 870 | ret |
869 | .end sys_getxgid | 871 | .end sys_getxgid |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 5e92ae00bdbb..2445a9d3488e 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -1772,20 +1772,20 @@ sys32_getgroups16 (int gidsetsize, short __user *grouplist) | |||
1772 | if (gidsetsize < 0) | 1772 | if (gidsetsize < 0) |
1773 | return -EINVAL; | 1773 | return -EINVAL; |
1774 | 1774 | ||
1775 | get_group_info(current->group_info); | 1775 | get_group_info(current->cred->group_info); |
1776 | i = current->group_info->ngroups; | 1776 | i = current->cred->group_info->ngroups; |
1777 | if (gidsetsize) { | 1777 | if (gidsetsize) { |
1778 | if (i > gidsetsize) { | 1778 | if (i > gidsetsize) { |
1779 | i = -EINVAL; | 1779 | i = -EINVAL; |
1780 | goto out; | 1780 | goto out; |
1781 | } | 1781 | } |
1782 | if (groups16_to_user(grouplist, current->group_info)) { | 1782 | if (groups16_to_user(grouplist, current->cred->group_info)) { |
1783 | i = -EFAULT; | 1783 | i = -EFAULT; |
1784 | goto out; | 1784 | goto out; |
1785 | } | 1785 | } |
1786 | } | 1786 | } |
1787 | out: | 1787 | out: |
1788 | put_group_info(current->group_info); | 1788 | put_group_info(current->cred->group_info); |
1789 | return i; | 1789 | return i; |
1790 | } | 1790 | } |
1791 | 1791 | ||
diff --git a/arch/mips/kernel/kspd.c b/arch/mips/kernel/kspd.c index b0591ae0ce56..fd6e51224034 100644 --- a/arch/mips/kernel/kspd.c +++ b/arch/mips/kernel/kspd.c | |||
@@ -174,8 +174,8 @@ static unsigned int translate_open_flags(int flags) | |||
174 | 174 | ||
175 | static void sp_setfsuidgid( uid_t uid, gid_t gid) | 175 | static void sp_setfsuidgid( uid_t uid, gid_t gid) |
176 | { | 176 | { |
177 | current->fsuid = uid; | 177 | current->cred->fsuid = uid; |
178 | current->fsgid = gid; | 178 | current->cred->fsgid = gid; |
179 | 179 | ||
180 | key_fsuid_changed(current); | 180 | key_fsuid_changed(current); |
181 | key_fsgid_changed(current); | 181 | key_fsgid_changed(current); |
diff --git a/arch/s390/kernel/compat_linux.c b/arch/s390/kernel/compat_linux.c index 4646382af34f..6cc87d8c8682 100644 --- a/arch/s390/kernel/compat_linux.c +++ b/arch/s390/kernel/compat_linux.c | |||
@@ -148,9 +148,9 @@ asmlinkage long sys32_getresuid16(u16 __user *ruid, u16 __user *euid, u16 __user | |||
148 | { | 148 | { |
149 | int retval; | 149 | int retval; |
150 | 150 | ||
151 | if (!(retval = put_user(high2lowuid(current->uid), ruid)) && | 151 | if (!(retval = put_user(high2lowuid(current->cred->uid), ruid)) && |
152 | !(retval = put_user(high2lowuid(current->euid), euid))) | 152 | !(retval = put_user(high2lowuid(current->cred->euid), euid))) |
153 | retval = put_user(high2lowuid(current->suid), suid); | 153 | retval = put_user(high2lowuid(current->cred->suid), suid); |
154 | 154 | ||
155 | return retval; | 155 | return retval; |
156 | } | 156 | } |
@@ -165,9 +165,9 @@ asmlinkage long sys32_getresgid16(u16 __user *rgid, u16 __user *egid, u16 __user | |||
165 | { | 165 | { |
166 | int retval; | 166 | int retval; |
167 | 167 | ||
168 | if (!(retval = put_user(high2lowgid(current->gid), rgid)) && | 168 | if (!(retval = put_user(high2lowgid(current->cred->gid), rgid)) && |
169 | !(retval = put_user(high2lowgid(current->egid), egid))) | 169 | !(retval = put_user(high2lowgid(current->cred->egid), egid))) |
170 | retval = put_user(high2lowgid(current->sgid), sgid); | 170 | retval = put_user(high2lowgid(current->cred->sgid), sgid); |
171 | 171 | ||
172 | return retval; | 172 | return retval; |
173 | } | 173 | } |
@@ -217,20 +217,20 @@ asmlinkage long sys32_getgroups16(int gidsetsize, u16 __user *grouplist) | |||
217 | if (gidsetsize < 0) | 217 | if (gidsetsize < 0) |
218 | return -EINVAL; | 218 | return -EINVAL; |
219 | 219 | ||
220 | get_group_info(current->group_info); | 220 | get_group_info(current->cred->group_info); |
221 | i = current->group_info->ngroups; | 221 | i = current->cred->group_info->ngroups; |
222 | if (gidsetsize) { | 222 | if (gidsetsize) { |
223 | if (i > gidsetsize) { | 223 | if (i > gidsetsize) { |
224 | i = -EINVAL; | 224 | i = -EINVAL; |
225 | goto out; | 225 | goto out; |
226 | } | 226 | } |
227 | if (groups16_to_user(grouplist, current->group_info)) { | 227 | if (groups16_to_user(grouplist, current->cred->group_info)) { |
228 | i = -EFAULT; | 228 | i = -EFAULT; |
229 | goto out; | 229 | goto out; |
230 | } | 230 | } |
231 | } | 231 | } |
232 | out: | 232 | out: |
233 | put_group_info(current->group_info); | 233 | put_group_info(current->cred->group_info); |
234 | return i; | 234 | return i; |
235 | } | 235 | } |
236 | 236 | ||
@@ -261,22 +261,22 @@ asmlinkage long sys32_setgroups16(int gidsetsize, u16 __user *grouplist) | |||
261 | 261 | ||
262 | asmlinkage long sys32_getuid16(void) | 262 | asmlinkage long sys32_getuid16(void) |
263 | { | 263 | { |
264 | return high2lowuid(current->uid); | 264 | return high2lowuid(current->cred->uid); |
265 | } | 265 | } |
266 | 266 | ||
267 | asmlinkage long sys32_geteuid16(void) | 267 | asmlinkage long sys32_geteuid16(void) |
268 | { | 268 | { |
269 | return high2lowuid(current->euid); | 269 | return high2lowuid(current->cred->euid); |
270 | } | 270 | } |
271 | 271 | ||
272 | asmlinkage long sys32_getgid16(void) | 272 | asmlinkage long sys32_getgid16(void) |
273 | { | 273 | { |
274 | return high2lowgid(current->gid); | 274 | return high2lowgid(current->cred->gid); |
275 | } | 275 | } |
276 | 276 | ||
277 | asmlinkage long sys32_getegid16(void) | 277 | asmlinkage long sys32_getegid16(void) |
278 | { | 278 | { |
279 | return high2lowgid(current->egid); | 279 | return high2lowgid(current->cred->egid); |
280 | } | 280 | } |
281 | 281 | ||
282 | /* | 282 | /* |