mirror of
https://github.com/torvalds/linux.git
synced 2026-01-25 07:47:50 +00:00
Merge tag 'sysctl-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl
Pull sysctl updates from Joel Granados:
- Move vm_table members out of kernel/sysctl.c
All vm_table array members have moved to their respective subsystems
leading to the removal of vm_table from kernel/sysctl.c. This
increases modularity by placing the ctl_tables closer to where they
are actually used and at the same time reducing the chances of merge
conflicts in kernel/sysctl.c.
- ctl_table range fixes
Replace the proc_handler function that checks variable ranges in
coredump_sysctls and vdso_table with the one that actually uses the
extra{1,2} pointers as min/max values. This tightens the range of the
values that users can pass into the kernel effectively preventing
{under,over}flows.
- Misc fixes
Correct grammar errors and typos in test messages. Update sysctl
files in MAINTAINERS. Constified and removed array size in
declaration for alignment_tbl
* tag 'sysctl-6.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl: (22 commits)
selftests/sysctl: fix wording of help messages
selftests: fix spelling/grammar errors in sysctl/sysctl.sh
MAINTAINERS: Update sysctl file list in MAINTAINERS
sysctl: Fix underflow value setting risk in vm_table
coredump: Fixes core_pipe_limit sysctl proc_handler
sysctl: remove unneeded include
sysctl: remove the vm_table
sh: vdso: move the sysctl to arch/sh/kernel/vsyscall/vsyscall.c
x86: vdso: move the sysctl to arch/x86/entry/vdso/vdso32-setup.c
fs: dcache: move the sysctl to fs/dcache.c
sunrpc: simplify rpcauth_cache_shrink_count()
fs: drop_caches: move sysctl to fs/drop_caches.c
fs: fs-writeback: move sysctl to fs/fs-writeback.c
mm: nommu: move sysctl to mm/nommu.c
security: min_addr: move sysctl to security/min_addr.c
mm: mmap: move sysctl to mm/mmap.c
mm: util: move sysctls to mm/util.c
mm: vmscan: move vmscan sysctls to mm/vmscan.c
mm: swap: move sysctl to mm/swap.c
mm: filemap: move sysctl to mm/filemap.c
...
This commit is contained in:
221
kernel/sysctl.c
221
kernel/sysctl.c
@@ -20,9 +20,6 @@
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/mm.h>
|
||||
#include <linux/swap.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/sysctl.h>
|
||||
#include <linux/bitmap.h>
|
||||
#include <linux/signal.h>
|
||||
@@ -31,7 +28,6 @@
|
||||
#include <linux/proc_fs.h>
|
||||
#include <linux/security.h>
|
||||
#include <linux/ctype.h>
|
||||
#include <linux/kmemleak.h>
|
||||
#include <linux/filter.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
@@ -42,25 +38,20 @@
|
||||
#include <linux/highuid.h>
|
||||
#include <linux/writeback.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/hugetlb.h>
|
||||
#include <linux/initrd.h>
|
||||
#include <linux/key.h>
|
||||
#include <linux/times.h>
|
||||
#include <linux/limits.h>
|
||||
#include <linux/dcache.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/vmstat.h>
|
||||
#include <linux/nfs_fs.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/reboot.h>
|
||||
#include <linux/ftrace.h>
|
||||
#include <linux/oom.h>
|
||||
#include <linux/kmod.h>
|
||||
#include <linux/capability.h>
|
||||
#include <linux/binfmts.h>
|
||||
#include <linux/sched/sysctl.h>
|
||||
#include <linux/mount.h>
|
||||
#include <linux/userfaultfd_k.h>
|
||||
#include <linux/pid.h>
|
||||
|
||||
#include "../lib/kstrtox.h"
|
||||
@@ -122,12 +113,6 @@ enum sysctl_writes_mode {
|
||||
|
||||
static enum sysctl_writes_mode sysctl_writes_strict = SYSCTL_WRITES_STRICT;
|
||||
#endif /* CONFIG_PROC_SYSCTL */
|
||||
|
||||
#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
|
||||
defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
|
||||
int sysctl_legacy_va_layout;
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_SYSCTL */
|
||||
|
||||
/*
|
||||
@@ -1901,215 +1886,9 @@ static const struct ctl_table kern_table[] = {
|
||||
#endif
|
||||
};
|
||||
|
||||
static const struct ctl_table vm_table[] = {
|
||||
{
|
||||
.procname = "overcommit_memory",
|
||||
.data = &sysctl_overcommit_memory,
|
||||
.maxlen = sizeof(sysctl_overcommit_memory),
|
||||
.mode = 0644,
|
||||
.proc_handler = overcommit_policy_handler,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_TWO,
|
||||
},
|
||||
{
|
||||
.procname = "overcommit_ratio",
|
||||
.data = &sysctl_overcommit_ratio,
|
||||
.maxlen = sizeof(sysctl_overcommit_ratio),
|
||||
.mode = 0644,
|
||||
.proc_handler = overcommit_ratio_handler,
|
||||
},
|
||||
{
|
||||
.procname = "overcommit_kbytes",
|
||||
.data = &sysctl_overcommit_kbytes,
|
||||
.maxlen = sizeof(sysctl_overcommit_kbytes),
|
||||
.mode = 0644,
|
||||
.proc_handler = overcommit_kbytes_handler,
|
||||
},
|
||||
{
|
||||
.procname = "page-cluster",
|
||||
.data = &page_cluster,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = (void *)&page_cluster_max,
|
||||
},
|
||||
{
|
||||
.procname = "dirtytime_expire_seconds",
|
||||
.data = &dirtytime_expire_interval,
|
||||
.maxlen = sizeof(dirtytime_expire_interval),
|
||||
.mode = 0644,
|
||||
.proc_handler = dirtytime_interval_handler,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
{
|
||||
.procname = "swappiness",
|
||||
.data = &vm_swappiness,
|
||||
.maxlen = sizeof(vm_swappiness),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_TWO_HUNDRED,
|
||||
},
|
||||
#ifdef CONFIG_NUMA
|
||||
{
|
||||
.procname = "numa_stat",
|
||||
.data = &sysctl_vm_numa_stat,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0644,
|
||||
.proc_handler = sysctl_vm_numa_stat_handler,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
.extra2 = SYSCTL_ONE,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.procname = "drop_caches",
|
||||
.data = &sysctl_drop_caches,
|
||||
.maxlen = sizeof(int),
|
||||
.mode = 0200,
|
||||
.proc_handler = drop_caches_sysctl_handler,
|
||||
.extra1 = SYSCTL_ONE,
|
||||
.extra2 = SYSCTL_FOUR,
|
||||
},
|
||||
{
|
||||
.procname = "page_lock_unfairness",
|
||||
.data = &sysctl_page_lock_unfairness,
|
||||
.maxlen = sizeof(sysctl_page_lock_unfairness),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#ifdef CONFIG_MMU
|
||||
{
|
||||
.procname = "max_map_count",
|
||||
.data = &sysctl_max_map_count,
|
||||
.maxlen = sizeof(sysctl_max_map_count),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#else
|
||||
{
|
||||
.procname = "nr_trim_pages",
|
||||
.data = &sysctl_nr_trim_pages,
|
||||
.maxlen = sizeof(sysctl_nr_trim_pages),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.procname = "vfs_cache_pressure",
|
||||
.data = &sysctl_vfs_cache_pressure,
|
||||
.maxlen = sizeof(sysctl_vfs_cache_pressure),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#if defined(HAVE_ARCH_PICK_MMAP_LAYOUT) || \
|
||||
defined(CONFIG_ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT)
|
||||
{
|
||||
.procname = "legacy_va_layout",
|
||||
.data = &sysctl_legacy_va_layout,
|
||||
.maxlen = sizeof(sysctl_legacy_va_layout),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_NUMA
|
||||
{
|
||||
.procname = "zone_reclaim_mode",
|
||||
.data = &node_reclaim_mode,
|
||||
.maxlen = sizeof(node_reclaim_mode),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_SMP
|
||||
{
|
||||
.procname = "stat_interval",
|
||||
.data = &sysctl_stat_interval,
|
||||
.maxlen = sizeof(sysctl_stat_interval),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec_jiffies,
|
||||
},
|
||||
{
|
||||
.procname = "stat_refresh",
|
||||
.data = NULL,
|
||||
.maxlen = 0,
|
||||
.mode = 0600,
|
||||
.proc_handler = vmstat_refresh,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_MMU
|
||||
{
|
||||
.procname = "mmap_min_addr",
|
||||
.data = &dac_mmap_min_addr,
|
||||
.maxlen = sizeof(unsigned long),
|
||||
.mode = 0644,
|
||||
.proc_handler = mmap_min_addr_handler,
|
||||
},
|
||||
#endif
|
||||
#if (defined(CONFIG_X86_32) && !defined(CONFIG_UML))|| \
|
||||
(defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
|
||||
{
|
||||
.procname = "vdso_enabled",
|
||||
#ifdef CONFIG_X86_32
|
||||
.data = &vdso32_enabled,
|
||||
.maxlen = sizeof(vdso32_enabled),
|
||||
#else
|
||||
.data = &vdso_enabled,
|
||||
.maxlen = sizeof(vdso_enabled),
|
||||
#endif
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_dointvec,
|
||||
.extra1 = SYSCTL_ZERO,
|
||||
},
|
||||
#endif
|
||||
{
|
||||
.procname = "user_reserve_kbytes",
|
||||
.data = &sysctl_user_reserve_kbytes,
|
||||
.maxlen = sizeof(sysctl_user_reserve_kbytes),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_doulongvec_minmax,
|
||||
},
|
||||
{
|
||||
.procname = "admin_reserve_kbytes",
|
||||
.data = &sysctl_admin_reserve_kbytes,
|
||||
.maxlen = sizeof(sysctl_admin_reserve_kbytes),
|
||||
.mode = 0644,
|
||||
.proc_handler = proc_doulongvec_minmax,
|
||||
},
|
||||
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_BITS
|
||||
{
|
||||
.procname = "mmap_rnd_bits",
|
||||
.data = &mmap_rnd_bits,
|
||||
.maxlen = sizeof(mmap_rnd_bits),
|
||||
.mode = 0600,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = (void *)&mmap_rnd_bits_min,
|
||||
.extra2 = (void *)&mmap_rnd_bits_max,
|
||||
},
|
||||
#endif
|
||||
#ifdef CONFIG_HAVE_ARCH_MMAP_RND_COMPAT_BITS
|
||||
{
|
||||
.procname = "mmap_rnd_compat_bits",
|
||||
.data = &mmap_rnd_compat_bits,
|
||||
.maxlen = sizeof(mmap_rnd_compat_bits),
|
||||
.mode = 0600,
|
||||
.proc_handler = proc_dointvec_minmax,
|
||||
.extra1 = (void *)&mmap_rnd_compat_bits_min,
|
||||
.extra2 = (void *)&mmap_rnd_compat_bits_max,
|
||||
},
|
||||
#endif
|
||||
};
|
||||
|
||||
int __init sysctl_init_bases(void)
|
||||
{
|
||||
register_sysctl_init("kernel", kern_table);
|
||||
register_sysctl_init("vm", vm_table);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user