|
@@ -81,7 +81,7 @@ int cap_capable(const struct cred *cred, struct user_namespace *targ_ns,
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
/* Do we have the necessary capabilities? */
|
|
/* Do we have the necessary capabilities? */
|
|
- if (targ_ns == cred->user->user_ns)
|
|
|
|
|
|
+ if (targ_ns == cred->user_ns)
|
|
return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
|
|
return cap_raised(cred->cap_effective, cap) ? 0 : -EPERM;
|
|
|
|
|
|
/* Have we tried all of the parent namespaces? */
|
|
/* Have we tried all of the parent namespaces? */
|
|
@@ -136,10 +136,10 @@ int cap_ptrace_access_check(struct task_struct *child, unsigned int mode)
|
|
rcu_read_lock();
|
|
rcu_read_lock();
|
|
cred = current_cred();
|
|
cred = current_cred();
|
|
child_cred = __task_cred(child);
|
|
child_cred = __task_cred(child);
|
|
- if (cred->user->user_ns == child_cred->user->user_ns &&
|
|
|
|
|
|
+ if (cred->user_ns == child_cred->user_ns &&
|
|
cap_issubset(child_cred->cap_permitted, cred->cap_permitted))
|
|
cap_issubset(child_cred->cap_permitted, cred->cap_permitted))
|
|
goto out;
|
|
goto out;
|
|
- if (ns_capable(child_cred->user->user_ns, CAP_SYS_PTRACE))
|
|
|
|
|
|
+ if (ns_capable(child_cred->user_ns, CAP_SYS_PTRACE))
|
|
goto out;
|
|
goto out;
|
|
ret = -EPERM;
|
|
ret = -EPERM;
|
|
out:
|
|
out:
|
|
@@ -168,10 +168,10 @@ int cap_ptrace_traceme(struct task_struct *parent)
|
|
rcu_read_lock();
|
|
rcu_read_lock();
|
|
cred = __task_cred(parent);
|
|
cred = __task_cred(parent);
|
|
child_cred = current_cred();
|
|
child_cred = current_cred();
|
|
- if (cred->user->user_ns == child_cred->user->user_ns &&
|
|
|
|
|
|
+ if (cred->user_ns == child_cred->user_ns &&
|
|
cap_issubset(child_cred->cap_permitted, cred->cap_permitted))
|
|
cap_issubset(child_cred->cap_permitted, cred->cap_permitted))
|
|
goto out;
|
|
goto out;
|
|
- if (has_ns_capability(parent, child_cred->user->user_ns, CAP_SYS_PTRACE))
|
|
|
|
|
|
+ if (has_ns_capability(parent, child_cred->user_ns, CAP_SYS_PTRACE))
|
|
goto out;
|
|
goto out;
|
|
ret = -EPERM;
|
|
ret = -EPERM;
|
|
out:
|
|
out:
|
|
@@ -214,7 +214,7 @@ static inline int cap_inh_is_capped(void)
|
|
/* they are so limited unless the current task has the CAP_SETPCAP
|
|
/* they are so limited unless the current task has the CAP_SETPCAP
|
|
* capability
|
|
* capability
|
|
*/
|
|
*/
|
|
- if (cap_capable(current_cred(), current_cred()->user->user_ns,
|
|
|
|
|
|
+ if (cap_capable(current_cred(), current_cred()->user_ns,
|
|
CAP_SETPCAP, SECURITY_CAP_AUDIT) == 0)
|
|
CAP_SETPCAP, SECURITY_CAP_AUDIT) == 0)
|
|
return 0;
|
|
return 0;
|
|
return 1;
|
|
return 1;
|
|
@@ -866,7 +866,7 @@ int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
|
|
|| ((new->securebits & SECURE_ALL_LOCKS & ~arg2)) /*[2]*/
|
|
|| ((new->securebits & SECURE_ALL_LOCKS & ~arg2)) /*[2]*/
|
|
|| (arg2 & ~(SECURE_ALL_LOCKS | SECURE_ALL_BITS)) /*[3]*/
|
|
|| (arg2 & ~(SECURE_ALL_LOCKS | SECURE_ALL_BITS)) /*[3]*/
|
|
|| (cap_capable(current_cred(),
|
|
|| (cap_capable(current_cred(),
|
|
- current_cred()->user->user_ns, CAP_SETPCAP,
|
|
|
|
|
|
+ current_cred()->user_ns, CAP_SETPCAP,
|
|
SECURITY_CAP_AUDIT) != 0) /*[4]*/
|
|
SECURITY_CAP_AUDIT) != 0) /*[4]*/
|
|
/*
|
|
/*
|
|
* [1] no changing of bits that are locked
|
|
* [1] no changing of bits that are locked
|