mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 03:27:44 -04:00
userns: Convert ptrace, kill, set_priority permission checks to work with kuids and kgids
Update the permission checks to use the new uid_eq and gid_eq helpers and remove the now unnecessary user_ns equality comparison. Acked-by: Serge Hallyn <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
This commit is contained in:
parent
a29c33f4e5
commit
5af662030e
3 changed files with 20 additions and 26 deletions
|
|
@ -198,13 +198,12 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode)
|
|||
return 0;
|
||||
rcu_read_lock();
|
||||
tcred = __task_cred(task);
|
||||
if (cred->user_ns == tcred->user_ns &&
|
||||
(cred->uid == tcred->euid &&
|
||||
cred->uid == tcred->suid &&
|
||||
cred->uid == tcred->uid &&
|
||||
cred->gid == tcred->egid &&
|
||||
cred->gid == tcred->sgid &&
|
||||
cred->gid == tcred->gid))
|
||||
if (uid_eq(cred->uid, tcred->euid) &&
|
||||
uid_eq(cred->uid, tcred->suid) &&
|
||||
uid_eq(cred->uid, tcred->uid) &&
|
||||
gid_eq(cred->gid, tcred->egid) &&
|
||||
gid_eq(cred->gid, tcred->sgid) &&
|
||||
gid_eq(cred->gid, tcred->gid))
|
||||
goto ok;
|
||||
if (ptrace_has_cap(tcred->user_ns, mode))
|
||||
goto ok;
|
||||
|
|
|
|||
Loading…
Reference in a new issue