History

Merge branch 'akpm' (patches from Andrew)

Merge more updates from Andrew Morton: "147 patches, based on 7d2a07b769330c34b4deabeed939325c77a7ec2f. Subsystems affected by this patch series: mm (memory-hotplug, rmap, ioremap, highmem, cleanups, secretmem, kfence, damon, and vmscan), alpha, percpu, procfs, misc, core-kernel, MAINTAINERS, lib, checkpatch, epoll, init, nilfs2, coredump, fork, pids, criu, kconfig, selftests, ipc, and scripts" * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (94 commits) scripts: check_extable: fix typo in user error message mm/workingset: correct kernel-doc notations ipc: replace costly bailout check in sysvipc_find_ipc() selftests/memfd: remove unused variable Kconfig.debug: drop selecting non-existing HARDLOCKUP_DETECTOR_ARCH configs: remove the obsolete CONFIG_INPUT_POLLDEV prctl: allow to setup brk for et_dyn executables pid: cleanup the stale comment mentioning pidmap_init(). kernel/fork.c: unexport get_{mm,task}_exe_file coredump: fix memleak in dump_vma_snapshot() fs/coredump.c: log if a core dump is aborted due to changed file permissions nilfs2: use refcount_dec_and_lock() to fix potential UAF nilfs2: fix memory leak in nilfs_sysfs_delete_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_create_snapshot_group nilfs2: fix memory leak in nilfs_sysfs_delete_##name##_group nilfs2: fix memory leak in nilfs_sysfs_create_##name##_group nilfs2: fix NULL pointer in nilfs_##name##_attr_release nilfs2: fix memory leak in nilfs_sysfs_create_device_group trap: cleanup trap_init() init: move usermodehelper_enable() to populate_rootfs() ...

Linus Torvalds committed 5 years ago

Commit 2d338202 parents cc09ee8 b285437149 files · +5341 −930Browse files

Showing the changes to kernel (5 of 149 files). Show all

Unified · Split

5 files
  1. kernel/acct.c +1 −1
  2. kernel/fork.c +0 −2
  3. kernel/profile.c +11 −10
  4. kernel/sys.c +0 −7
  5. kernel/user.c +25 −0
kernel/acct.c+1−1
@@ -478,7 +478,7 @@ static void do_acct_process(struct bsd_acct_struct *acct) · 477 unmodified lines
478 /*478 /*
479 * Accounting records are not subject to resource limits.479 * Accounting records are not subject to resource limits.
480 */480 */
481 flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;481 flim = rlimit(RLIMIT_FSIZE);
482 current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;482 current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
483 /* Perform file operations on behalf of whoever enabled accounting */483 /* Perform file operations on behalf of whoever enabled accounting */
484 orig_cred = override_creds(file->f_cred);484 orig_cred = override_creds(file->f_cred);
kernel/fork.c+0−2
@@ -1262,7 +1262,6 @@ struct file *get_mm_exe_file(struct mm_struct *mm) · 1261 unmodified lines
1262 rcu_read_unlock();1262 rcu_read_unlock();
1263 return exe_file;1263 return exe_file;
1264}1264}
1265EXPORT_SYMBOL(get_mm_exe_file);
1266 1265
1267/**1266/**
1268 * get_task_exe_file - acquire a reference to the task's executable file1267 * get_task_exe_file - acquire a reference to the task's executable file
@@ -1285,7 +1284,6 @@ struct file *get_task_exe_file(struct task_struct *task) · 16 unmodified lines
1285 task_unlock(task);1284 task_unlock(task);
1286 return exe_file;1285 return exe_file;
1287}1286}
1288EXPORT_SYMBOL(get_task_exe_file);
1289 1287
1290/**1288/**
1291 * get_task_mm - acquire a reference to the task's mm1289 * get_task_mm - acquire a reference to the task's mm
kernel/profile.c+11−10
@@ -41,7 +41,8 @@ struct profile_hit { · 40 unmodified lines
41#define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ)41#define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ)
42 42
43static atomic_t *prof_buffer;43static atomic_t *prof_buffer;
44static unsigned long prof_len, prof_shift;44static unsigned long prof_len;
45static unsigned short int prof_shift;
45 46
46int prof_on __read_mostly;47int prof_on __read_mostly;
47EXPORT_SYMBOL_GPL(prof_on);48EXPORT_SYMBOL_GPL(prof_on);
@@ -67,8 +68,8 @@ int profile_setup(char *str) · 19 unmodified lines
67 if (str[strlen(sleepstr)] == ',')68 if (str[strlen(sleepstr)] == ',')
68 str += strlen(sleepstr) + 1;69 str += strlen(sleepstr) + 1;
69 if (get_option(&str, &par))70 if (get_option(&str, &par))
70 prof_shift = par;71 prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
71 pr_info("kernel sleep profiling enabled (shift: %ld)\n",72 pr_info("kernel sleep profiling enabled (shift: %u)\n",
72 prof_shift);73 prof_shift);
73#else74#else
74 pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n");75 pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n");
@@ -78,21 +79,21 @@ int profile_setup(char *str) · 3 unmodified lines
78 if (str[strlen(schedstr)] == ',')79 if (str[strlen(schedstr)] == ',')
79 str += strlen(schedstr) + 1;80 str += strlen(schedstr) + 1;
80 if (get_option(&str, &par))81 if (get_option(&str, &par))
81 prof_shift = par;82 prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
82 pr_info("kernel schedule profiling enabled (shift: %ld)\n",83 pr_info("kernel schedule profiling enabled (shift: %u)\n",
83 prof_shift);84 prof_shift);
84 } else if (!strncmp(str, kvmstr, strlen(kvmstr))) {85 } else if (!strncmp(str, kvmstr, strlen(kvmstr))) {
85 prof_on = KVM_PROFILING;86 prof_on = KVM_PROFILING;
86 if (str[strlen(kvmstr)] == ',')87 if (str[strlen(kvmstr)] == ',')
87 str += strlen(kvmstr) + 1;88 str += strlen(kvmstr) + 1;
88 if (get_option(&str, &par))89 if (get_option(&str, &par))
89 prof_shift = par;90 prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
90 pr_info("kernel KVM profiling enabled (shift: %ld)\n",91 pr_info("kernel KVM profiling enabled (shift: %u)\n",
91 prof_shift);92 prof_shift);
92 } else if (get_option(&str, &par)) {93 } else if (get_option(&str, &par)) {
93 prof_shift = par;94 prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
94 prof_on = CPU_PROFILING;95 prof_on = CPU_PROFILING;
95 pr_info("kernel profiling enabled (shift: %ld)\n",96 pr_info("kernel profiling enabled (shift: %u)\n",
96 prof_shift);97 prof_shift);
97 }98 }
98 return 1;99 return 1;
@@ -468,7 +469,7 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos) · 369 unmodified lines
468 unsigned long p = *ppos;469 unsigned long p = *ppos;
469 ssize_t read;470 ssize_t read;
470 char *pnt;471 char *pnt;
471 unsigned int sample_step = 1 << prof_shift;472 unsigned long sample_step = 1UL << prof_shift;
472 473
473 profile_flip_buffers();474 profile_flip_buffers();
474 if (p >= (prof_len+1)*sizeof(unsigned int))475 if (p >= (prof_len+1)*sizeof(unsigned int))
kernel/sys.c+0−7
@@ -1929,13 +1929,6 @@ static int validate_prctl_map_addr(struct prctl_mm_map *prctl_map) · 1928 unmodified lines
1929 1929
1930 error = -EINVAL;1930 error = -EINVAL;
1931 1931
1932 /*
1933 * @brk should be after @end_data in traditional maps.
1934 */
1935 if (prctl_map->start_brk <= prctl_map->end_data ||
1936 prctl_map->brk <= prctl_map->end_data)
1937 goto out;
1938
1939 /*1932 /*
1940 * Neither we should allow to override limits if they set.1933 * Neither we should allow to override limits if they set.
1941 */1934 */
kernel/user.c+25−0
@@ -129,6 +129,22 @@ static struct user_struct *uid_hash_find(kuid_t uid, struct hlist_head *hashent) · 128 unmodified lines
129 return NULL;129 return NULL;
130}130}
131 131
132static int user_epoll_alloc(struct user_struct *up)
133{
134#ifdef CONFIG_EPOLL
135 return percpu_counter_init(&up->epoll_watches, 0, GFP_KERNEL);
136#else
137 return 0;
138#endif
139}
140
141static void user_epoll_free(struct user_struct *up)
142{
143#ifdef CONFIG_EPOLL
144 percpu_counter_destroy(&up->epoll_watches);
145#endif
146}
147
132/* IRQs are disabled and uidhash_lock is held upon function entry.148/* IRQs are disabled and uidhash_lock is held upon function entry.
133 * IRQ state (as stored in flags) is restored and uidhash_lock released149 * IRQ state (as stored in flags) is restored and uidhash_lock released
134 * upon function exit.150 * upon function exit.
@@ -138,6 +154,7 @@ static void free_user(struct user_struct *up, unsigned long flags) · 3 unmodified lines
138{154{
139 uid_hash_remove(up);155 uid_hash_remove(up);
140 spin_unlock_irqrestore(&uidhash_lock, flags);156 spin_unlock_irqrestore(&uidhash_lock, flags);
157 user_epoll_free(up);
141 kmem_cache_free(uid_cachep, up);158 kmem_cache_free(uid_cachep, up);
142}159}
143 160
@@ -185,6 +202,10 @@ struct user_struct *alloc_uid(kuid_t uid) · 41 unmodified lines
185 202
186 new->uid = uid;203 new->uid = uid;
187 refcount_set(&new->__count, 1);204 refcount_set(&new->__count, 1);
205 if (user_epoll_alloc(new)) {
206 kmem_cache_free(uid_cachep, new);
207 return NULL;
208 }
188 ratelimit_state_init(&new->ratelimit, HZ, 100);209 ratelimit_state_init(&new->ratelimit, HZ, 100);
189 ratelimit_set_flags(&new->ratelimit, RATELIMIT_MSG_ON_RELEASE);210 ratelimit_set_flags(&new->ratelimit, RATELIMIT_MSG_ON_RELEASE);
190 211
@@ -195,6 +216,7 @@ struct user_struct *alloc_uid(kuid_t uid) · 4 unmodified lines
195 spin_lock_irq(&uidhash_lock);216 spin_lock_irq(&uidhash_lock);
196 up = uid_hash_find(uid, hashent);217 up = uid_hash_find(uid, hashent);
197 if (up) {218 if (up) {
219 user_epoll_free(new);
198 kmem_cache_free(uid_cachep, new);220 kmem_cache_free(uid_cachep, new);
199 } else {221 } else {
200 uid_hash_insert(new, hashent);222 uid_hash_insert(new, hashent);
@@ -216,6 +238,9 @@ static int __init uid_cache_init(void) · 15 unmodified lines
216 for(n = 0; n < UIDHASH_SZ; ++n)238 for(n = 0; n < UIDHASH_SZ; ++n)
217 INIT_HLIST_HEAD(uidhash_table + n);239 INIT_HLIST_HEAD(uidhash_table + n);
218 240
241 if (user_epoll_alloc(&root_user))
242 panic("root_user epoll percpu counter alloc failed");
243
219 /* Insert the root user immediately (init already runs as root) */244 /* Insert the root user immediately (init already runs as root) */
220 spin_lock_irq(&uidhash_lock);245 spin_lock_irq(&uidhash_lock);
221 uid_hash_insert(&root_user, uidhashentry(GLOBAL_ROOT_UID));246 uid_hash_insert(&root_user, uidhashentry(GLOBAL_ROOT_UID));