diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mempolicy.c | 4 | ||||
-rw-r--r-- | mm/migrate.c | 4 | ||||
-rw-r--r-- | mm/oom_kill.c | 4 | ||||
-rw-r--r-- | mm/shmem.c | 22 |
4 files changed, 22 insertions, 12 deletions
diff --git a/mm/mempolicy.c b/mm/mempolicy.c index b19569137529..39fd416ae14f 100644 --- a/mm/mempolicy.c +++ b/mm/mempolicy.c | |||
@@ -1334,8 +1334,8 @@ SYSCALL_DEFINE4(migrate_pages, pid_t, pid, unsigned long, maxnode, | |||
1334 | * userid as the target process. | 1334 | * userid as the target process. |
1335 | */ | 1335 | */ |
1336 | tcred = __task_cred(task); | 1336 | tcred = __task_cred(task); |
1337 | if (cred->euid != tcred->suid && cred->euid != tcred->uid && | 1337 | if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) && |
1338 | cred->uid != tcred->suid && cred->uid != tcred->uid && | 1338 | !uid_eq(cred->uid, tcred->suid) && !uid_eq(cred->uid, tcred->uid) && |
1339 | !capable(CAP_SYS_NICE)) { | 1339 | !capable(CAP_SYS_NICE)) { |
1340 | rcu_read_unlock(); | 1340 | rcu_read_unlock(); |
1341 | err = -EPERM; | 1341 | err = -EPERM; |
diff --git a/mm/migrate.c b/mm/migrate.c index 11072383ae12..ab81d482ae6f 100644 --- a/mm/migrate.c +++ b/mm/migrate.c | |||
@@ -1371,8 +1371,8 @@ SYSCALL_DEFINE6(move_pages, pid_t, pid, unsigned long, nr_pages, | |||
1371 | * userid as the target process. | 1371 | * userid as the target process. |
1372 | */ | 1372 | */ |
1373 | tcred = __task_cred(task); | 1373 | tcred = __task_cred(task); |
1374 | if (cred->euid != tcred->suid && cred->euid != tcred->uid && | 1374 | if (!uid_eq(cred->euid, tcred->suid) && !uid_eq(cred->euid, tcred->uid) && |
1375 | cred->uid != tcred->suid && cred->uid != tcred->uid && | 1375 | !uid_eq(cred->uid, tcred->suid) && !uid_eq(cred->uid, tcred->uid) && |
1376 | !capable(CAP_SYS_NICE)) { | 1376 | !capable(CAP_SYS_NICE)) { |
1377 | rcu_read_unlock(); | 1377 | rcu_read_unlock(); |
1378 | err = -EPERM; | 1378 | err = -EPERM; |
diff --git a/mm/oom_kill.c b/mm/oom_kill.c index 46bf2ed5594c..9f09a1fde9f9 100644 --- a/mm/oom_kill.c +++ b/mm/oom_kill.c | |||
@@ -410,8 +410,8 @@ static void dump_tasks(const struct mem_cgroup *memcg, const nodemask_t *nodemas | |||
410 | } | 410 | } |
411 | 411 | ||
412 | pr_info("[%5d] %5d %5d %8lu %8lu %3u %3d %5d %s\n", | 412 | pr_info("[%5d] %5d %5d %8lu %8lu %3u %3d %5d %s\n", |
413 | task->pid, task_uid(task), task->tgid, | 413 | task->pid, from_kuid(&init_user_ns, task_uid(task)), |
414 | task->mm->total_vm, get_mm_rss(task->mm), | 414 | task->tgid, task->mm->total_vm, get_mm_rss(task->mm), |
415 | task_cpu(task), task->signal->oom_adj, | 415 | task_cpu(task), task->signal->oom_adj, |
416 | task->signal->oom_score_adj, task->comm); | 416 | task->signal->oom_score_adj, task->comm); |
417 | task_unlock(task); | 417 | task_unlock(task); |
diff --git a/mm/shmem.c b/mm/shmem.c index f99ff3e50bd6..d7b433a1ef5e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -2075,6 +2075,8 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, | |||
2075 | bool remount) | 2075 | bool remount) |
2076 | { | 2076 | { |
2077 | char *this_char, *value, *rest; | 2077 | char *this_char, *value, *rest; |
2078 | uid_t uid; | ||
2079 | gid_t gid; | ||
2078 | 2080 | ||
2079 | while (options != NULL) { | 2081 | while (options != NULL) { |
2080 | this_char = options; | 2082 | this_char = options; |
@@ -2134,15 +2136,21 @@ static int shmem_parse_options(char *options, struct shmem_sb_info *sbinfo, | |||
2134 | } else if (!strcmp(this_char,"uid")) { | 2136 | } else if (!strcmp(this_char,"uid")) { |
2135 | if (remount) | 2137 | if (remount) |
2136 | continue; | 2138 | continue; |
2137 | sbinfo->uid = simple_strtoul(value, &rest, 0); | 2139 | uid = simple_strtoul(value, &rest, 0); |
2138 | if (*rest) | 2140 | if (*rest) |
2139 | goto bad_val; | 2141 | goto bad_val; |
2142 | sbinfo->uid = make_kuid(current_user_ns(), uid); | ||
2143 | if (!uid_valid(sbinfo->uid)) | ||
2144 | goto bad_val; | ||
2140 | } else if (!strcmp(this_char,"gid")) { | 2145 | } else if (!strcmp(this_char,"gid")) { |
2141 | if (remount) | 2146 | if (remount) |
2142 | continue; | 2147 | continue; |
2143 | sbinfo->gid = simple_strtoul(value, &rest, 0); | 2148 | gid = simple_strtoul(value, &rest, 0); |
2144 | if (*rest) | 2149 | if (*rest) |
2145 | goto bad_val; | 2150 | goto bad_val; |
2151 | sbinfo->gid = make_kgid(current_user_ns(), gid); | ||
2152 | if (!gid_valid(sbinfo->gid)) | ||
2153 | goto bad_val; | ||
2146 | } else if (!strcmp(this_char,"mpol")) { | 2154 | } else if (!strcmp(this_char,"mpol")) { |
2147 | if (mpol_parse_str(value, &sbinfo->mpol, 1)) | 2155 | if (mpol_parse_str(value, &sbinfo->mpol, 1)) |
2148 | goto bad_val; | 2156 | goto bad_val; |
@@ -2210,10 +2218,12 @@ static int shmem_show_options(struct seq_file *seq, struct dentry *root) | |||
2210 | seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); | 2218 | seq_printf(seq, ",nr_inodes=%lu", sbinfo->max_inodes); |
2211 | if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) | 2219 | if (sbinfo->mode != (S_IRWXUGO | S_ISVTX)) |
2212 | seq_printf(seq, ",mode=%03ho", sbinfo->mode); | 2220 | seq_printf(seq, ",mode=%03ho", sbinfo->mode); |
2213 | if (sbinfo->uid != 0) | 2221 | if (!uid_eq(sbinfo->uid, GLOBAL_ROOT_UID)) |
2214 | seq_printf(seq, ",uid=%u", sbinfo->uid); | 2222 | seq_printf(seq, ",uid=%u", |
2215 | if (sbinfo->gid != 0) | 2223 | from_kuid_munged(&init_user_ns, sbinfo->uid)); |
2216 | seq_printf(seq, ",gid=%u", sbinfo->gid); | 2224 | if (!gid_eq(sbinfo->gid, GLOBAL_ROOT_GID)) |
2225 | seq_printf(seq, ",gid=%u", | ||
2226 | from_kgid_munged(&init_user_ns, sbinfo->gid)); | ||
2217 | shmem_show_mpol(seq, sbinfo->mpol); | 2227 | shmem_show_mpol(seq, sbinfo->mpol); |
2218 | return 0; | 2228 | return 0; |
2219 | } | 2229 | } |