mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-27 09:02:06 +00:00
Merge branch 'for-linus' of git://selinuxproject.org/~jmorris/linux-security
* 'for-linus' of git://selinuxproject.org/~jmorris/linux-security: capabilities: remove __cap_full_set definition security: remove the security_netlink_recv hook as it is equivalent to capable() ptrace: do not audit capability check when outputing /proc/pid/stat capabilities: remove task_ns_* functions capabitlies: ns_capable can use the cap helpers rather than lsm call capabilities: style only - move capable below ns_capable capabilites: introduce new has_ns_capabilities_noaudit capabilities: call has_ns_capability from has_capability capabilities: remove all _real_ interfaces capabilities: introduce security_capable_noaudit capabilities: reverse arguments to security_capable capabilities: remove the task from capable LSM hook entirely selinux: sparse fix: fix several warnings in the security server cod selinux: sparse fix: fix warnings in netlink code selinux: sparse fix: eliminate warnings for selinuxfs selinux: sparse fix: declare selinux_disable() in security.h selinux: sparse fix: move selinux_complete_init selinux: sparse fix: make selinux_secmark_refcount static SELinux: Fix RCU deref check warning in sel_netport_insert() Manually fix up a semantic mis-merge wrt security_netlink_recv(): - the interface was removed in commitfd77846152
("security: remove the security_netlink_recv hook as it is equivalent to capable()") - a new user of it appeared in commita38f7907b9
("crypto: Add userspace configuration API") causing no automatic merge conflict, but Eric Paris pointed out the issue.
This commit is contained in:
commit
c49c41a413
24 changed files with 134 additions and 203 deletions
|
@ -172,6 +172,14 @@ int ptrace_check_attach(struct task_struct *child, bool ignore_state)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode)
|
||||
{
|
||||
if (mode & PTRACE_MODE_NOAUDIT)
|
||||
return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE);
|
||||
else
|
||||
return has_ns_capability(current, ns, CAP_SYS_PTRACE);
|
||||
}
|
||||
|
||||
int __ptrace_may_access(struct task_struct *task, unsigned int mode)
|
||||
{
|
||||
const struct cred *cred = current_cred(), *tcred;
|
||||
|
@ -198,7 +206,7 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode)
|
|||
cred->gid == tcred->sgid &&
|
||||
cred->gid == tcred->gid))
|
||||
goto ok;
|
||||
if (ns_capable(tcred->user->user_ns, CAP_SYS_PTRACE))
|
||||
if (ptrace_has_cap(tcred->user->user_ns, mode))
|
||||
goto ok;
|
||||
rcu_read_unlock();
|
||||
return -EPERM;
|
||||
|
@ -207,7 +215,7 @@ ok:
|
|||
smp_rmb();
|
||||
if (task->mm)
|
||||
dumpable = get_dumpable(task->mm);
|
||||
if (!dumpable && !task_ns_capable(task, CAP_SYS_PTRACE))
|
||||
if (!dumpable && !ptrace_has_cap(task_user_ns(task), mode))
|
||||
return -EPERM;
|
||||
|
||||
return security_ptrace_access_check(task, mode);
|
||||
|
@ -277,7 +285,7 @@ static int ptrace_attach(struct task_struct *task, long request,
|
|||
task->ptrace = PT_PTRACED;
|
||||
if (seize)
|
||||
task->ptrace |= PT_SEIZED;
|
||||
if (task_ns_capable(task, CAP_SYS_PTRACE))
|
||||
if (ns_capable(task_user_ns(task), CAP_SYS_PTRACE))
|
||||
task->ptrace |= PT_PTRACE_CAP;
|
||||
|
||||
__ptrace_link(task, current);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue