projects
/
platform
/
adaptation
/
renesas_rcar
/
renesas_kernel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
CAPABILITIES: remove undefined caps from all processes
[platform/adaptation/renesas_rcar/renesas_kernel.git]
/
security
/
commoncap.c
diff --git
a/security/commoncap.c
b/security/commoncap.c
index
c44b6fe
..
963dc59
100644
(file)
--- a/
security/commoncap.c
+++ b/
security/commoncap.c
@@
-421,6
+421,9
@@
int get_vfs_caps_from_disk(const struct dentry *dentry, struct cpu_vfs_cap_data
cpu_caps->inheritable.cap[i] = le32_to_cpu(caps.data[i].inheritable);
}
cpu_caps->inheritable.cap[i] = le32_to_cpu(caps.data[i].inheritable);
}
+ cpu_caps->permitted.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK;
+ cpu_caps->inheritable.cap[CAP_LAST_U32] &= CAP_LAST_U32_VALID_MASK;
+
return 0;
}
return 0;
}
@@
-768,16
+771,16
@@
int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags)
*/
static int cap_safe_nice(struct task_struct *p)
{
*/
static int cap_safe_nice(struct task_struct *p)
{
- int is_subset;
+ int is_subset
, ret = 0
;
rcu_read_lock();
is_subset = cap_issubset(__task_cred(p)->cap_permitted,
current_cred()->cap_permitted);
rcu_read_lock();
is_subset = cap_issubset(__task_cred(p)->cap_permitted,
current_cred()->cap_permitted);
+ if (!is_subset && !ns_capable(__task_cred(p)->user_ns, CAP_SYS_NICE))
+ ret = -EPERM;
rcu_read_unlock();
rcu_read_unlock();
- if (!is_subset && !capable(CAP_SYS_NICE))
- return -EPERM;
- return 0;
+ return ret;
}
/**
}
/**
@@
-824,7
+827,7
@@
int cap_task_setnice(struct task_struct *p, int nice)
*/
static long cap_prctl_drop(struct cred *new, unsigned long cap)
{
*/
static long cap_prctl_drop(struct cred *new, unsigned long cap)
{
- if (!
capable(
CAP_SETPCAP))
+ if (!
ns_capable(current_user_ns(),
CAP_SETPCAP))
return -EPERM;
if (!cap_valid(cap))
return -EINVAL;
return -EPERM;
if (!cap_valid(cap))
return -EINVAL;