mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
CRED: Wrap task credential accesses in the core kernel
Wrap access to task credentials so that they can be separated more easily from the task_struct during the introduction of COW creds. Change most current->(|e|s|fs)[ug]id to current_(|e|s|fs)[ug]id(). Change some task->e?[ug]id to task_e?[ug]id(). In some places it makes more sense to use RCU directly rather than a convenient wrapper; these will be addressed by later patches. Signed-off-by: David Howells <[email protected]> Reviewed-by: James Morris <[email protected]> Acked-by: Serge Hallyn <[email protected]> Cc: Al Viro <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Signed-off-by: James Morris <[email protected]>
This commit is contained in:
parent
b103c59883
commit
76aac0e9a1
15 changed files with 72 additions and 52 deletions
|
|
@ -123,16 +123,19 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode)
|
|||
* because setting up the necessary parent/child relationship
|
||||
* or halting the specified task is impossible.
|
||||
*/
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
int dumpable = 0;
|
||||
/* Don't let security modules deny introspection */
|
||||
if (task == current)
|
||||
return 0;
|
||||
if (((current->uid != task->euid) ||
|
||||
(current->uid != task->suid) ||
|
||||
(current->uid != task->uid) ||
|
||||
(current->gid != task->egid) ||
|
||||
(current->gid != task->sgid) ||
|
||||
(current->gid != task->gid)) && !capable(CAP_SYS_PTRACE))
|
||||
current_uid_gid(&uid, &gid);
|
||||
if ((uid != task->euid ||
|
||||
uid != task->suid ||
|
||||
uid != task->uid ||
|
||||
gid != task->egid ||
|
||||
gid != task->sgid ||
|
||||
gid != task->gid) && !capable(CAP_SYS_PTRACE))
|
||||
return -EPERM;
|
||||
smp_rmb();
|
||||
if (task->mm)
|
||||
|
|
|
|||
Loading…
Reference in a new issue