Merge branch 'akpm' (patches from Andrew)
Merge more updates from Andrew Morton:
"147 patches, based on 7d2a07b769.
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()
...
This commit is contained in:
@@ -478,7 +478,7 @@ static void do_acct_process(struct bsd_acct_struct *acct)
|
||||
/*
|
||||
* Accounting records are not subject to resource limits.
|
||||
*/
|
||||
flim = current->signal->rlim[RLIMIT_FSIZE].rlim_cur;
|
||||
flim = rlimit(RLIMIT_FSIZE);
|
||||
current->signal->rlim[RLIMIT_FSIZE].rlim_cur = RLIM_INFINITY;
|
||||
/* Perform file operations on behalf of whoever enabled accounting */
|
||||
orig_cred = override_creds(file->f_cred);
|
||||
|
||||
@@ -1262,7 +1262,6 @@ struct file *get_mm_exe_file(struct mm_struct *mm)
|
||||
rcu_read_unlock();
|
||||
return exe_file;
|
||||
}
|
||||
EXPORT_SYMBOL(get_mm_exe_file);
|
||||
|
||||
/**
|
||||
* 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)
|
||||
task_unlock(task);
|
||||
return exe_file;
|
||||
}
|
||||
EXPORT_SYMBOL(get_task_exe_file);
|
||||
|
||||
/**
|
||||
* get_task_mm - acquire a reference to the task's mm
|
||||
|
||||
@@ -41,7 +41,8 @@ struct profile_hit {
|
||||
#define NR_PROFILE_GRP (NR_PROFILE_HIT/PROFILE_GRPSZ)
|
||||
|
||||
static atomic_t *prof_buffer;
|
||||
static unsigned long prof_len, prof_shift;
|
||||
static unsigned long prof_len;
|
||||
static unsigned short int prof_shift;
|
||||
|
||||
int prof_on __read_mostly;
|
||||
EXPORT_SYMBOL_GPL(prof_on);
|
||||
@@ -67,8 +68,8 @@ int profile_setup(char *str)
|
||||
if (str[strlen(sleepstr)] == ',')
|
||||
str += strlen(sleepstr) + 1;
|
||||
if (get_option(&str, &par))
|
||||
prof_shift = par;
|
||||
pr_info("kernel sleep profiling enabled (shift: %ld)\n",
|
||||
prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
|
||||
pr_info("kernel sleep profiling enabled (shift: %u)\n",
|
||||
prof_shift);
|
||||
#else
|
||||
pr_warn("kernel sleep profiling requires CONFIG_SCHEDSTATS\n");
|
||||
@@ -78,21 +79,21 @@ int profile_setup(char *str)
|
||||
if (str[strlen(schedstr)] == ',')
|
||||
str += strlen(schedstr) + 1;
|
||||
if (get_option(&str, &par))
|
||||
prof_shift = par;
|
||||
pr_info("kernel schedule profiling enabled (shift: %ld)\n",
|
||||
prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
|
||||
pr_info("kernel schedule profiling enabled (shift: %u)\n",
|
||||
prof_shift);
|
||||
} else if (!strncmp(str, kvmstr, strlen(kvmstr))) {
|
||||
prof_on = KVM_PROFILING;
|
||||
if (str[strlen(kvmstr)] == ',')
|
||||
str += strlen(kvmstr) + 1;
|
||||
if (get_option(&str, &par))
|
||||
prof_shift = par;
|
||||
pr_info("kernel KVM profiling enabled (shift: %ld)\n",
|
||||
prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
|
||||
pr_info("kernel KVM profiling enabled (shift: %u)\n",
|
||||
prof_shift);
|
||||
} else if (get_option(&str, &par)) {
|
||||
prof_shift = par;
|
||||
prof_shift = clamp(par, 0, BITS_PER_LONG - 1);
|
||||
prof_on = CPU_PROFILING;
|
||||
pr_info("kernel profiling enabled (shift: %ld)\n",
|
||||
pr_info("kernel profiling enabled (shift: %u)\n",
|
||||
prof_shift);
|
||||
}
|
||||
return 1;
|
||||
@@ -468,7 +469,7 @@ read_profile(struct file *file, char __user *buf, size_t count, loff_t *ppos)
|
||||
unsigned long p = *ppos;
|
||||
ssize_t read;
|
||||
char *pnt;
|
||||
unsigned int sample_step = 1 << prof_shift;
|
||||
unsigned long sample_step = 1UL << prof_shift;
|
||||
|
||||
profile_flip_buffers();
|
||||
if (p >= (prof_len+1)*sizeof(unsigned int))
|
||||
|
||||
@@ -1929,13 +1929,6 @@ static int validate_prctl_map_addr(struct prctl_mm_map *prctl_map)
|
||||
|
||||
error = -EINVAL;
|
||||
|
||||
/*
|
||||
* @brk should be after @end_data in traditional maps.
|
||||
*/
|
||||
if (prctl_map->start_brk <= prctl_map->end_data ||
|
||||
prctl_map->brk <= prctl_map->end_data)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* Neither we should allow to override limits if they set.
|
||||
*/
|
||||
|
||||
@@ -129,6 +129,22 @@ static struct user_struct *uid_hash_find(kuid_t uid, struct hlist_head *hashent)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static int user_epoll_alloc(struct user_struct *up)
|
||||
{
|
||||
#ifdef CONFIG_EPOLL
|
||||
return percpu_counter_init(&up->epoll_watches, 0, GFP_KERNEL);
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void user_epoll_free(struct user_struct *up)
|
||||
{
|
||||
#ifdef CONFIG_EPOLL
|
||||
percpu_counter_destroy(&up->epoll_watches);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* IRQs are disabled and uidhash_lock is held upon function entry.
|
||||
* IRQ state (as stored in flags) is restored and uidhash_lock released
|
||||
* upon function exit.
|
||||
@@ -138,6 +154,7 @@ static void free_user(struct user_struct *up, unsigned long flags)
|
||||
{
|
||||
uid_hash_remove(up);
|
||||
spin_unlock_irqrestore(&uidhash_lock, flags);
|
||||
user_epoll_free(up);
|
||||
kmem_cache_free(uid_cachep, up);
|
||||
}
|
||||
|
||||
@@ -185,6 +202,10 @@ struct user_struct *alloc_uid(kuid_t uid)
|
||||
|
||||
new->uid = uid;
|
||||
refcount_set(&new->__count, 1);
|
||||
if (user_epoll_alloc(new)) {
|
||||
kmem_cache_free(uid_cachep, new);
|
||||
return NULL;
|
||||
}
|
||||
ratelimit_state_init(&new->ratelimit, HZ, 100);
|
||||
ratelimit_set_flags(&new->ratelimit, RATELIMIT_MSG_ON_RELEASE);
|
||||
|
||||
@@ -195,6 +216,7 @@ struct user_struct *alloc_uid(kuid_t uid)
|
||||
spin_lock_irq(&uidhash_lock);
|
||||
up = uid_hash_find(uid, hashent);
|
||||
if (up) {
|
||||
user_epoll_free(new);
|
||||
kmem_cache_free(uid_cachep, new);
|
||||
} else {
|
||||
uid_hash_insert(new, hashent);
|
||||
@@ -216,6 +238,9 @@ static int __init uid_cache_init(void)
|
||||
for(n = 0; n < UIDHASH_SZ; ++n)
|
||||
INIT_HLIST_HEAD(uidhash_table + n);
|
||||
|
||||
if (user_epoll_alloc(&root_user))
|
||||
panic("root_user epoll percpu counter alloc failed");
|
||||
|
||||
/* Insert the root user immediately (init already runs as root) */
|
||||
spin_lock_irq(&uidhash_lock);
|
||||
uid_hash_insert(&root_user, uidhashentry(GLOBAL_ROOT_UID));
|
||||
|
||||
Reference in New Issue
Block a user