aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/ptrace.c4
-rw-r--r--kernel/sched/core.c2
-rw-r--r--kernel/signal.c4
-rw-r--r--kernel/sys.c8
-rw-r--r--kernel/user_namespace.c4
-rw-r--r--kernel/utsname.c2
6 files changed, 12 insertions, 12 deletions
diff --git a/kernel/ptrace.c b/kernel/ptrace.c
index ee8d49b9c309..24e0a5a94824 100644
--- a/kernel/ptrace.c
+++ b/kernel/ptrace.c
@@ -198,7 +198,7 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode)
198 return 0; 198 return 0;
199 rcu_read_lock(); 199 rcu_read_lock();
200 tcred = __task_cred(task); 200 tcred = __task_cred(task);
201 if (cred->user->user_ns == tcred->user->user_ns && 201 if (cred->user_ns == tcred->user_ns &&
202 (cred->uid == tcred->euid && 202 (cred->uid == tcred->euid &&
203 cred->uid == tcred->suid && 203 cred->uid == tcred->suid &&
204 cred->uid == tcred->uid && 204 cred->uid == tcred->uid &&
@@ -206,7 +206,7 @@ int __ptrace_may_access(struct task_struct *task, unsigned int mode)
206 cred->gid == tcred->sgid && 206 cred->gid == tcred->sgid &&
207 cred->gid == tcred->gid)) 207 cred->gid == tcred->gid))
208 goto ok; 208 goto ok;
209 if (ptrace_has_cap(tcred->user->user_ns, mode)) 209 if (ptrace_has_cap(tcred->user_ns, mode))
210 goto ok; 210 goto ok;
211 rcu_read_unlock(); 211 rcu_read_unlock();
212 return -EPERM; 212 return -EPERM;
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index 4603b9d8f30a..96bff855b866 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4042,7 +4042,7 @@ static bool check_same_owner(struct task_struct *p)
4042 4042
4043 rcu_read_lock(); 4043 rcu_read_lock();
4044 pcred = __task_cred(p); 4044 pcred = __task_cred(p);
4045 if (cred->user->user_ns == pcred->user->user_ns) 4045 if (cred->user_ns == pcred->user_ns)
4046 match = (cred->euid == pcred->euid || 4046 match = (cred->euid == pcred->euid ||
4047 cred->euid == pcred->uid); 4047 cred->euid == pcred->uid);
4048 else 4048 else
diff --git a/kernel/signal.c b/kernel/signal.c
index 17afcaf582d0..e2c5d84f2dac 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -767,14 +767,14 @@ static int kill_ok_by_cred(struct task_struct *t)
767 const struct cred *cred = current_cred(); 767 const struct cred *cred = current_cred();
768 const struct cred *tcred = __task_cred(t); 768 const struct cred *tcred = __task_cred(t);
769 769
770 if (cred->user->user_ns == tcred->user->user_ns && 770 if (cred->user_ns == tcred->user_ns &&
771 (cred->euid == tcred->suid || 771 (cred->euid == tcred->suid ||
772 cred->euid == tcred->uid || 772 cred->euid == tcred->uid ||
773 cred->uid == tcred->suid || 773 cred->uid == tcred->suid ||
774 cred->uid == tcred->uid)) 774 cred->uid == tcred->uid))
775 return 1; 775 return 1;
776 776
777 if (ns_capable(tcred->user->user_ns, CAP_KILL)) 777 if (ns_capable(tcred->user_ns, CAP_KILL))
778 return 1; 778 return 1;
779 779
780 return 0; 780 return 0;
diff --git a/kernel/sys.c b/kernel/sys.c
index f7a43514ac65..82d8714bbede 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -133,11 +133,11 @@ static bool set_one_prio_perm(struct task_struct *p)
133{ 133{
134 const struct cred *cred = current_cred(), *pcred = __task_cred(p); 134 const struct cred *cred = current_cred(), *pcred = __task_cred(p);
135 135
136 if (pcred->user->user_ns == cred->user->user_ns && 136 if (pcred->user_ns == cred->user_ns &&
137 (pcred->uid == cred->euid || 137 (pcred->uid == cred->euid ||
138 pcred->euid == cred->euid)) 138 pcred->euid == cred->euid))
139 return true; 139 return true;
140 if (ns_capable(pcred->user->user_ns, CAP_SYS_NICE)) 140 if (ns_capable(pcred->user_ns, CAP_SYS_NICE))
141 return true; 141 return true;
142 return false; 142 return false;
143} 143}
@@ -1498,7 +1498,7 @@ static int check_prlimit_permission(struct task_struct *task)
1498 return 0; 1498 return 0;
1499 1499
1500 tcred = __task_cred(task); 1500 tcred = __task_cred(task);
1501 if (cred->user->user_ns == tcred->user->user_ns && 1501 if (cred->user_ns == tcred->user_ns &&
1502 (cred->uid == tcred->euid && 1502 (cred->uid == tcred->euid &&
1503 cred->uid == tcred->suid && 1503 cred->uid == tcred->suid &&
1504 cred->uid == tcred->uid && 1504 cred->uid == tcred->uid &&
@@ -1506,7 +1506,7 @@ static int check_prlimit_permission(struct task_struct *task)
1506 cred->gid == tcred->sgid && 1506 cred->gid == tcred->sgid &&
1507 cred->gid == tcred->gid)) 1507 cred->gid == tcred->gid))
1508 return 0; 1508 return 0;
1509 if (ns_capable(tcred->user->user_ns, CAP_SYS_RESOURCE)) 1509 if (ns_capable(tcred->user_ns, CAP_SYS_RESOURCE))
1510 return 0; 1510 return 0;
1511 1511
1512 return -EPERM; 1512 return -EPERM;
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 3b906e98b1db..f084083a0fd3 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -90,7 +90,7 @@ uid_t user_ns_map_uid(struct user_namespace *to, const struct cred *cred, uid_t
90{ 90{
91 struct user_namespace *tmp; 91 struct user_namespace *tmp;
92 92
93 if (likely(to == cred->user->user_ns)) 93 if (likely(to == cred->user_ns))
94 return uid; 94 return uid;
95 95
96 96
@@ -112,7 +112,7 @@ gid_t user_ns_map_gid(struct user_namespace *to, const struct cred *cred, gid_t
112{ 112{
113 struct user_namespace *tmp; 113 struct user_namespace *tmp;
114 114
115 if (likely(to == cred->user->user_ns)) 115 if (likely(to == cred->user_ns))
116 return gid; 116 return gid;
117 117
118 /* Is cred->user the creator of the target user_ns 118 /* Is cred->user the creator of the target user_ns
diff --git a/kernel/utsname.c b/kernel/utsname.c
index 405caf91aad5..679d97a5d3fd 100644
--- a/kernel/utsname.c
+++ b/kernel/utsname.c
@@ -43,7 +43,7 @@ static struct uts_namespace *clone_uts_ns(struct task_struct *tsk,
43 43
44 down_read(&uts_sem); 44 down_read(&uts_sem);
45 memcpy(&ns->name, &old_ns->name, sizeof(ns->name)); 45 memcpy(&ns->name, &old_ns->name, sizeof(ns->name));
46 ns->user_ns = get_user_ns(task_cred_xxx(tsk, user)->user_ns); 46 ns->user_ns = get_user_ns(task_cred_xxx(tsk, user_ns));
47 up_read(&uts_sem); 47 up_read(&uts_sem);
48 return ns; 48 return ns;
49} 49}