mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-04 20:19:47 +08:00
Summary
* Move sysctls out of the kern_table array This is the final move of ctl_tables into their respective subsystems. Only 5 (out of the original 50) will remain in kernel/sysctl.c file; these handle either sysctl or common arch variables. By decentralizing sysctl registrations, subsystem maintainers regain control over their sysctl interfaces, improving maintainability and reducing the likelihood of merge conflicts. * docs: Remove false positives from check-sysctl-docs Stopped falsely identifying sysctls as undocumented or unimplemented in the check-sysctl-docs script. This script can now be used to automatically identify if documentation is missing. * Testing All these have been in linux-next since rc3, giving them a solid 3 to 4 weeks worth of testing. Additionally, sysctl selftests and kunit were also run locally on my x86_64 -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmiAvd8ACgkQupfNUreW QU+9nAv/dtxaKoL4BXJSzsA2+49bbo9QfiK5Vjz1wSRYRQTb+jhGr9QdS5hG+NeX uN2ilvcNQqW7ENdiblU10lvcbPjIn2hw4lbMcpv/+QXnrudtGYlBFXlkWqW5nv7X AVvHU8y3uzfs6JbRIpROUA7Cn2cDOlfP2mMtwxCXR3iP+orS1ziuVEi1JRoirIyG iq5I/1rJMJBU3FjqqDTq6yljspLx8AlXO1yc5xUxAM67IcY4ew3ZTxqiZr6M9AhV DUbR2lu/88wcFNERt8DJmuQ50dSGGqOEpK3FURTmkwtMFxzNLmenFDQeBKKahz3Q 2ntXSDfp2y+ppZNmcOP8tZZkra03Xpy1DQyoOgQ2r9uGekPxyr+wmKXwYPOeJIPO YWTNBm8omX9qr49zVzaZ1f2foRGfgStHL6aa6xLIf34zzScSDEPtO3og2+5Hw/30 gnp+7v9E19uKpoE6oiGE0PtiFzAi/I6nFxzG2RRqrlMLFXyKVccTKygzY6tCnI3P 6144s/Bt =R369 -----END PGP SIGNATURE----- Merge tag 'sysctl-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl Pull sysctl updates from Joel Granados: - Move sysctls out of the kern_table array This is the final move of ctl_tables into their respective subsystems. Only 5 (out of the original 50) will remain in kernel/sysctl.c file; these handle either sysctl or common arch variables. By decentralizing sysctl registrations, subsystem maintainers regain control over their sysctl interfaces, improving maintainability and reducing the likelihood of merge conflicts. - docs: Remove false positives from check-sysctl-docs Stopped falsely identifying sysctls as undocumented or unimplemented in the check-sysctl-docs script. This script can now be used to automatically identify if documentation is missing. * tag 'sysctl-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/sysctl/sysctl: (23 commits) docs: Downgrade arm64 & riscv from titles to comment docs: Replace spaces with tabs in check-sysctl-docs docs: Remove colon from ctltable title in vm.rst docs: Add awk section for ucount sysctl entries docs: Use skiplist when checking sysctl admin-guide docs: nixify check-sysctl-docs sysctl: rename kern_table -> sysctl_subsys_table kernel/sys.c: Move overflow{uid,gid} sysctl into kernel/sys.c uevent: mv uevent_helper into kobject_uevent.c sysctl: Removed unused variable sysctl: Nixify sysctl.sh sysctl: Remove superfluous includes from kernel/sysctl.c sysctl: Remove (very) old file changelog sysctl: Move sysctl_panic_on_stackoverflow to kernel/panic.c sysctl: move cad_pid into kernel/pid.c sysctl: Move tainted ctl_table into kernel/panic.c Input: sysrq: mv sysrq into drivers/tty/sysrq.c fork: mv threads-max into kernel/fork.c parisc/power: Move soft-power into power.c mm: move randomize_va_space into memory.c ...
This commit is contained in:
commit
4b290aae78
@ -1014,30 +1014,26 @@ perf_user_access (arm64 and riscv only)
|
|||||||
|
|
||||||
Controls user space access for reading perf event counters.
|
Controls user space access for reading perf event counters.
|
||||||
|
|
||||||
arm64
|
* for arm64
|
||||||
=====
|
The default value is 0 (access disabled).
|
||||||
|
|
||||||
The default value is 0 (access disabled).
|
When set to 1, user space can read performance monitor counter registers
|
||||||
|
directly.
|
||||||
|
|
||||||
When set to 1, user space can read performance monitor counter registers
|
See Documentation/arch/arm64/perf.rst for more information.
|
||||||
directly.
|
|
||||||
|
|
||||||
See Documentation/arch/arm64/perf.rst for more information.
|
* for riscv
|
||||||
|
When set to 0, user space access is disabled.
|
||||||
|
|
||||||
riscv
|
The default value is 1, user space can read performance monitor counter
|
||||||
=====
|
registers through perf, any direct access without perf intervention will trigger
|
||||||
|
an illegal instruction.
|
||||||
|
|
||||||
When set to 0, user space access is disabled.
|
When set to 2, which enables legacy mode (user space has direct access to cycle
|
||||||
|
and insret CSRs only). Note that this legacy value is deprecated and will be
|
||||||
|
removed once all user space applications are fixed.
|
||||||
|
|
||||||
The default value is 1, user space can read performance monitor counter
|
Note that the time CSR is always directly accessible to all modes.
|
||||||
registers through perf, any direct access without perf intervention will trigger
|
|
||||||
an illegal instruction.
|
|
||||||
|
|
||||||
When set to 2, which enables legacy mode (user space has direct access to cycle
|
|
||||||
and insret CSRs only). Note that this legacy value is deprecated and will be
|
|
||||||
removed once all user space applications are fixed.
|
|
||||||
|
|
||||||
Note that the time CSR is always directly accessible to all modes.
|
|
||||||
|
|
||||||
pid_max
|
pid_max
|
||||||
=======
|
=======
|
||||||
|
@ -465,8 +465,8 @@ The minimum value is 1 (1/1 -> 100%). The value less than 1 completely
|
|||||||
disables protection of the pages.
|
disables protection of the pages.
|
||||||
|
|
||||||
|
|
||||||
max_map_count:
|
max_map_count
|
||||||
==============
|
=============
|
||||||
|
|
||||||
This file contains the maximum number of memory map areas a process
|
This file contains the maximum number of memory map areas a process
|
||||||
may have. Memory map areas are used as a side-effect of calling
|
may have. Memory map areas are used as a side-effect of calling
|
||||||
@ -495,8 +495,8 @@ memory allocations.
|
|||||||
The default value depends on CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT.
|
The default value depends on CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT.
|
||||||
|
|
||||||
|
|
||||||
memory_failure_early_kill:
|
memory_failure_early_kill
|
||||||
==========================
|
=========================
|
||||||
|
|
||||||
Control how to kill processes when uncorrected memory error (typically
|
Control how to kill processes when uncorrected memory error (typically
|
||||||
a 2bit error in a memory module) is detected in the background by hardware
|
a 2bit error in a memory module) is detected in the background by hardware
|
||||||
|
@ -83,7 +83,25 @@ static struct task_struct *power_task;
|
|||||||
#define SYSCTL_FILENAME "sys/kernel/power"
|
#define SYSCTL_FILENAME "sys/kernel/power"
|
||||||
|
|
||||||
/* soft power switch enabled/disabled */
|
/* soft power switch enabled/disabled */
|
||||||
int pwrsw_enabled __read_mostly = 1;
|
static int pwrsw_enabled __read_mostly = 1;
|
||||||
|
|
||||||
|
static const struct ctl_table power_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "soft-power",
|
||||||
|
.data = &pwrsw_enabled,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_power_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", power_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
arch_initcall(init_power_sysctl);
|
||||||
|
|
||||||
/* main kernel thread worker. It polls the button state */
|
/* main kernel thread worker. It polls the button state */
|
||||||
static int kpowerswd(void *param)
|
static int kpowerswd(void *param)
|
||||||
|
@ -1120,6 +1120,47 @@ int sysrq_toggle_support(int enable_mask)
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(sysrq_toggle_support);
|
EXPORT_SYMBOL_GPL(sysrq_toggle_support);
|
||||||
|
|
||||||
|
static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
|
||||||
|
void *buffer, size_t *lenp, loff_t *ppos)
|
||||||
|
{
|
||||||
|
int tmp, ret;
|
||||||
|
struct ctl_table t = *table;
|
||||||
|
|
||||||
|
tmp = sysrq_mask();
|
||||||
|
t.data = &tmp;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Behaves like do_proc_dointvec as t does not have min nor max.
|
||||||
|
*/
|
||||||
|
ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
|
||||||
|
|
||||||
|
if (ret || !write)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
if (write)
|
||||||
|
sysrq_toggle_support(tmp);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const struct ctl_table sysrq_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "sysrq",
|
||||||
|
.data = NULL,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = sysrq_sysctl_handler,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_sysrq_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", sysrq_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsys_initcall(init_sysrq_sysctl);
|
||||||
|
|
||||||
static int __sysrq_swap_key_ops(u8 key, const struct sysrq_key_op *insert_op_p,
|
static int __sysrq_swap_key_ops(u8 key, const struct sysrq_key_op *insert_op_p,
|
||||||
const struct sysrq_key_op *remove_op_p)
|
const struct sysrq_key_op *remove_op_p)
|
||||||
{
|
{
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
#include <linux/workqueue.h>
|
#include <linux/workqueue.h>
|
||||||
#include <linux/sysctl.h>
|
#include <linux/sysctl.h>
|
||||||
|
|
||||||
#define KMOD_PATH_LEN 256
|
|
||||||
|
|
||||||
#ifdef CONFIG_MODULES
|
#ifdef CONFIG_MODULES
|
||||||
extern char modprobe_path[]; /* for sysctl */
|
|
||||||
/* modprobe exit status on success, -ve on error. Return value
|
/* modprobe exit status on success, -ve on error. Return value
|
||||||
* usually useless though. */
|
* usually useless though. */
|
||||||
extern __printf(2, 3)
|
extern __printf(2, 3)
|
||||||
|
@ -304,7 +304,6 @@ struct notifier_block;
|
|||||||
|
|
||||||
#ifdef CONFIG_MODULES
|
#ifdef CONFIG_MODULES
|
||||||
|
|
||||||
extern int modules_disabled; /* for sysctl */
|
|
||||||
/* Get/put a kernel symbol (calls must be symmetric) */
|
/* Get/put a kernel symbol (calls must be symmetric) */
|
||||||
void *__symbol_get(const char *symbol);
|
void *__symbol_get(const char *symbol);
|
||||||
void *__symbol_get_gpl(const char *symbol);
|
void *__symbol_get_gpl(const char *symbol);
|
||||||
|
@ -25,8 +25,6 @@ extern int panic_on_warn;
|
|||||||
extern unsigned long panic_on_taint;
|
extern unsigned long panic_on_taint;
|
||||||
extern bool panic_on_taint_nousertaint;
|
extern bool panic_on_taint_nousertaint;
|
||||||
|
|
||||||
extern int sysctl_panic_on_rcu_stall;
|
|
||||||
extern int sysctl_max_rcu_stall_to_panic;
|
|
||||||
extern int sysctl_panic_on_stackoverflow;
|
extern int sysctl_panic_on_stackoverflow;
|
||||||
|
|
||||||
extern bool crash_kexec_post_notifiers;
|
extern bool crash_kexec_post_notifiers;
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
#include <linux/rbtree_types.h>
|
#include <linux/rbtree_types.h>
|
||||||
#include <linux/spinlock_types_raw.h>
|
#include <linux/spinlock_types_raw.h>
|
||||||
|
|
||||||
extern int max_lock_depth; /* for sysctl */
|
extern int max_lock_depth;
|
||||||
|
|
||||||
struct rt_mutex_base {
|
struct rt_mutex_base {
|
||||||
raw_spinlock_t wait_lock;
|
raw_spinlock_t wait_lock;
|
||||||
|
@ -242,9 +242,7 @@ int do_proc_douintvec(const struct ctl_table *table, int write,
|
|||||||
int write, void *data),
|
int write, void *data),
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
extern int pwrsw_enabled;
|
|
||||||
extern int unaligned_enabled;
|
extern int unaligned_enabled;
|
||||||
extern int unaligned_dump_stack;
|
|
||||||
extern int no_unaligned_warning;
|
extern int no_unaligned_warning;
|
||||||
|
|
||||||
#else /* CONFIG_SYSCTL */
|
#else /* CONFIG_SYSCTL */
|
||||||
@ -285,7 +283,4 @@ static inline bool sysctl_is_alias(char *param)
|
|||||||
}
|
}
|
||||||
#endif /* CONFIG_SYSCTL */
|
#endif /* CONFIG_SYSCTL */
|
||||||
|
|
||||||
int sysctl_max_threads(const struct ctl_table *table, int write, void *buffer,
|
|
||||||
size_t *lenp, loff_t *ppos);
|
|
||||||
|
|
||||||
#endif /* _LINUX_SYSCTL_H */
|
#endif /* _LINUX_SYSCTL_H */
|
||||||
|
@ -3219,7 +3219,7 @@ int unshare_files(void)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sysctl_max_threads(const struct ctl_table *table, int write,
|
static int sysctl_max_threads(const struct ctl_table *table, int write,
|
||||||
void *buffer, size_t *lenp, loff_t *ppos)
|
void *buffer, size_t *lenp, loff_t *ppos)
|
||||||
{
|
{
|
||||||
struct ctl_table t;
|
struct ctl_table t;
|
||||||
@ -3241,3 +3241,21 @@ int sysctl_max_threads(const struct ctl_table *table, int write,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct ctl_table fork_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "threads-max",
|
||||||
|
.data = NULL,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = sysctl_max_threads,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_fork_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", fork_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsys_initcall(init_fork_sysctl);
|
||||||
|
@ -13,6 +13,24 @@
|
|||||||
*/
|
*/
|
||||||
int max_lock_depth = 1024;
|
int max_lock_depth = 1024;
|
||||||
|
|
||||||
|
static const struct ctl_table rtmutex_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "max_lock_depth",
|
||||||
|
.data = &max_lock_depth,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_rtmutex_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", rtmutex_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsys_initcall(init_rtmutex_sysctl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Debug aware fast / slowpath lock,trylock,unlock
|
* Debug aware fast / slowpath lock,trylock,unlock
|
||||||
*
|
*
|
||||||
|
@ -58,6 +58,9 @@ extern const struct kernel_symbol __stop___ksymtab_gpl[];
|
|||||||
extern const u32 __start___kcrctab[];
|
extern const u32 __start___kcrctab[];
|
||||||
extern const u32 __start___kcrctab_gpl[];
|
extern const u32 __start___kcrctab_gpl[];
|
||||||
|
|
||||||
|
#define KMOD_PATH_LEN 256
|
||||||
|
extern char modprobe_path[];
|
||||||
|
|
||||||
struct load_info {
|
struct load_info {
|
||||||
const char *name;
|
const char *name;
|
||||||
/* pointer to module in temporary copy, freed at end of load_module() */
|
/* pointer to module in temporary copy, freed at end of load_module() */
|
||||||
|
@ -126,9 +126,37 @@ static void mod_update_bounds(struct module *mod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Block module loading/unloading? */
|
/* Block module loading/unloading? */
|
||||||
int modules_disabled;
|
static int modules_disabled;
|
||||||
core_param(nomodule, modules_disabled, bint, 0);
|
core_param(nomodule, modules_disabled, bint, 0);
|
||||||
|
|
||||||
|
static const struct ctl_table module_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "modprobe",
|
||||||
|
.data = &modprobe_path,
|
||||||
|
.maxlen = KMOD_PATH_LEN,
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dostring,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.procname = "modules_disabled",
|
||||||
|
.data = &modules_disabled,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
/* only handle a transition from default "0" to "1" */
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ONE,
|
||||||
|
.extra2 = SYSCTL_ONE,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_module_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", module_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsys_initcall(init_module_sysctl);
|
||||||
|
|
||||||
/* Waiting for a module to finish initializing? */
|
/* Waiting for a module to finish initializing? */
|
||||||
static DECLARE_WAIT_QUEUE_HEAD(module_wq);
|
static DECLARE_WAIT_QUEUE_HEAD(module_wq);
|
||||||
|
|
||||||
|
@ -84,6 +84,50 @@ ATOMIC_NOTIFIER_HEAD(panic_notifier_list);
|
|||||||
EXPORT_SYMBOL(panic_notifier_list);
|
EXPORT_SYMBOL(panic_notifier_list);
|
||||||
|
|
||||||
#ifdef CONFIG_SYSCTL
|
#ifdef CONFIG_SYSCTL
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Taint values can only be increased
|
||||||
|
* This means we can safely use a temporary.
|
||||||
|
*/
|
||||||
|
static int proc_taint(const struct ctl_table *table, int write,
|
||||||
|
void *buffer, size_t *lenp, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct ctl_table t;
|
||||||
|
unsigned long tmptaint = get_taint();
|
||||||
|
int err;
|
||||||
|
|
||||||
|
if (write && !capable(CAP_SYS_ADMIN))
|
||||||
|
return -EPERM;
|
||||||
|
|
||||||
|
t = *table;
|
||||||
|
t.data = &tmptaint;
|
||||||
|
err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
if (write) {
|
||||||
|
int i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we are relying on panic_on_taint not producing
|
||||||
|
* false positives due to userspace input, bail out
|
||||||
|
* before setting the requested taint flags.
|
||||||
|
*/
|
||||||
|
if (panic_on_taint_nousertaint && (tmptaint & panic_on_taint))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Poor man's atomic or. Not worth adding a primitive
|
||||||
|
* to everyone's atomic.h for this
|
||||||
|
*/
|
||||||
|
for (i = 0; i < TAINT_FLAGS_COUNT; i++)
|
||||||
|
if ((1UL << i) & tmptaint)
|
||||||
|
add_taint(i, LOCKDEP_STILL_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct ctl_table kern_panic_table[] = {
|
static const struct ctl_table kern_panic_table[] = {
|
||||||
#ifdef CONFIG_SMP
|
#ifdef CONFIG_SMP
|
||||||
{
|
{
|
||||||
@ -96,6 +140,12 @@ static const struct ctl_table kern_panic_table[] = {
|
|||||||
.extra2 = SYSCTL_ONE,
|
.extra2 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
|
{
|
||||||
|
.procname = "tainted",
|
||||||
|
.maxlen = sizeof(long),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_taint,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
.procname = "panic",
|
.procname = "panic",
|
||||||
.data = &panic_timeout,
|
.data = &panic_timeout,
|
||||||
@ -133,6 +183,16 @@ static const struct ctl_table kern_panic_table[] = {
|
|||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = proc_douintvec,
|
.proc_handler = proc_douintvec,
|
||||||
},
|
},
|
||||||
|
#if (defined(CONFIG_X86_32) || defined(CONFIG_PARISC)) && \
|
||||||
|
defined(CONFIG_DEBUG_STACKOVERFLOW)
|
||||||
|
{
|
||||||
|
.procname = "panic_on_stackoverflow",
|
||||||
|
.data = &sysctl_panic_on_stackoverflow,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec,
|
||||||
|
},
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
static __init int kernel_panic_sysctls_init(void)
|
static __init int kernel_panic_sysctls_init(void)
|
||||||
|
31
kernel/pid.c
31
kernel/pid.c
@ -713,6 +713,29 @@ static struct ctl_table_root pid_table_root = {
|
|||||||
.set_ownership = pid_table_root_set_ownership,
|
.set_ownership = pid_table_root_set_ownership,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static int proc_do_cad_pid(const struct ctl_table *table, int write, void *buffer,
|
||||||
|
size_t *lenp, loff_t *ppos)
|
||||||
|
{
|
||||||
|
struct pid *new_pid;
|
||||||
|
pid_t tmp_pid;
|
||||||
|
int r;
|
||||||
|
struct ctl_table tmp_table = *table;
|
||||||
|
|
||||||
|
tmp_pid = pid_vnr(cad_pid);
|
||||||
|
tmp_table.data = &tmp_pid;
|
||||||
|
|
||||||
|
r = proc_dointvec(&tmp_table, write, buffer, lenp, ppos);
|
||||||
|
if (r || !write)
|
||||||
|
return r;
|
||||||
|
|
||||||
|
new_pid = find_get_pid(tmp_pid);
|
||||||
|
if (!new_pid)
|
||||||
|
return -ESRCH;
|
||||||
|
|
||||||
|
put_pid(xchg(&cad_pid, new_pid));
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static const struct ctl_table pid_table[] = {
|
static const struct ctl_table pid_table[] = {
|
||||||
{
|
{
|
||||||
.procname = "pid_max",
|
.procname = "pid_max",
|
||||||
@ -723,6 +746,14 @@ static const struct ctl_table pid_table[] = {
|
|||||||
.extra1 = &pid_max_min,
|
.extra1 = &pid_max_min,
|
||||||
.extra2 = &pid_max_max,
|
.extra2 = &pid_max_max,
|
||||||
},
|
},
|
||||||
|
#ifdef CONFIG_PROC_SYSCTL
|
||||||
|
{
|
||||||
|
.procname = "cad_pid",
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0600,
|
||||||
|
.proc_handler = proc_do_cad_pid,
|
||||||
|
},
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -17,8 +17,37 @@
|
|||||||
// Controlling CPU stall warnings, including delay calculation.
|
// Controlling CPU stall warnings, including delay calculation.
|
||||||
|
|
||||||
/* panic() on RCU Stall sysctl. */
|
/* panic() on RCU Stall sysctl. */
|
||||||
int sysctl_panic_on_rcu_stall __read_mostly;
|
static int sysctl_panic_on_rcu_stall __read_mostly;
|
||||||
int sysctl_max_rcu_stall_to_panic __read_mostly;
|
static int sysctl_max_rcu_stall_to_panic __read_mostly;
|
||||||
|
|
||||||
|
static const struct ctl_table rcu_stall_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "panic_on_rcu_stall",
|
||||||
|
.data = &sysctl_panic_on_rcu_stall,
|
||||||
|
.maxlen = sizeof(sysctl_panic_on_rcu_stall),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ZERO,
|
||||||
|
.extra2 = SYSCTL_ONE,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.procname = "max_rcu_stall_to_panic",
|
||||||
|
.data = &sysctl_max_rcu_stall_to_panic,
|
||||||
|
.maxlen = sizeof(sysctl_max_rcu_stall_to_panic),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ONE,
|
||||||
|
.extra2 = SYSCTL_INT_MAX,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_rcu_stall_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", rcu_stall_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsys_initcall(init_rcu_stall_sysctl);
|
||||||
|
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
|
|
||||||
|
29
kernel/sys.c
29
kernel/sys.c
@ -181,6 +181,35 @@ int fs_overflowgid = DEFAULT_FS_OVERFLOWGID;
|
|||||||
EXPORT_SYMBOL(fs_overflowuid);
|
EXPORT_SYMBOL(fs_overflowuid);
|
||||||
EXPORT_SYMBOL(fs_overflowgid);
|
EXPORT_SYMBOL(fs_overflowgid);
|
||||||
|
|
||||||
|
static const struct ctl_table overflow_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "overflowuid",
|
||||||
|
.data = &overflowuid,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ZERO,
|
||||||
|
.extra2 = SYSCTL_MAXOLDUID,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
.procname = "overflowgid",
|
||||||
|
.data = &overflowgid,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec_minmax,
|
||||||
|
.extra1 = SYSCTL_ZERO,
|
||||||
|
.extra2 = SYSCTL_MAXOLDUID,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_overflow_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", overflow_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
postcore_initcall(init_overflow_sysctl);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns true if current's euid is same as p's uid or euid,
|
* Returns true if current's euid is same as p's uid or euid,
|
||||||
* or has CAP_SYS_NICE to p's user_ns.
|
* or has CAP_SYS_NICE to p's user_ns.
|
||||||
|
270
kernel/sysctl.c
270
kernel/sysctl.c
@ -1,69 +1,28 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/*
|
/*
|
||||||
* sysctl.c: General linux system control interface
|
* sysctl.c: General linux system control interface
|
||||||
*
|
|
||||||
* Begun 24 March 1995, Stephen Tweedie
|
|
||||||
* Added /proc support, Dec 1995
|
|
||||||
* Added bdflush entry and intvec min/max checking, 2/23/96, Tom Dyas.
|
|
||||||
* Added hooks for /proc/sys/net (minor, minor patch), 96/4/1, Mike Shaver.
|
|
||||||
* Added kernel/java-{interpreter,appletviewer}, 96/5/10, Mike Shaver.
|
|
||||||
* Dynamic registration fixes, Stephen Tweedie.
|
|
||||||
* Added kswapd-interval, ctrl-alt-del, printk stuff, 1/8/97, Chris Horn.
|
|
||||||
* Made sysctl support optional via CONFIG_SYSCTL, 1/10/97, Chris
|
|
||||||
* Horn.
|
|
||||||
* Added proc_doulongvec_ms_jiffies_minmax, 09/08/99, Carlos H. Bauer.
|
|
||||||
* Added proc_doulongvec_minmax, 09/08/99, Carlos H. Bauer.
|
|
||||||
* Changed linked lists to use list.h instead of lists.h, 02/24/00, Bill
|
|
||||||
* Wendling.
|
|
||||||
* The list_for_each() macro wasn't appropriate for the sysctl loop.
|
|
||||||
* Removed it and replaced it with older style, 03/23/00, Bill Wendling
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/module.h>
|
|
||||||
#include <linux/sysctl.h>
|
#include <linux/sysctl.h>
|
||||||
#include <linux/bitmap.h>
|
#include <linux/bitmap.h>
|
||||||
#include <linux/printk.h>
|
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/security.h>
|
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
#include <linux/filter.h>
|
|
||||||
#include <linux/fs.h>
|
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/kobject.h>
|
#include <linux/kobject.h>
|
||||||
#include <linux/net.h>
|
|
||||||
#include <linux/sysrq.h>
|
|
||||||
#include <linux/highuid.h>
|
#include <linux/highuid.h>
|
||||||
#include <linux/writeback.h>
|
#include <linux/writeback.h>
|
||||||
#include <linux/ratelimit.h>
|
|
||||||
#include <linux/initrd.h>
|
#include <linux/initrd.h>
|
||||||
#include <linux/key.h>
|
|
||||||
#include <linux/times.h>
|
#include <linux/times.h>
|
||||||
#include <linux/limits.h>
|
#include <linux/limits.h>
|
||||||
#include <linux/syscalls.h>
|
#include <linux/syscalls.h>
|
||||||
#include <linux/nfs_fs.h>
|
|
||||||
#include <linux/acpi.h>
|
|
||||||
#include <linux/reboot.h>
|
|
||||||
#include <linux/kmod.h>
|
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#include <linux/binfmts.h>
|
|
||||||
#include <linux/sched/sysctl.h>
|
|
||||||
#include <linux/mount.h>
|
|
||||||
#include <linux/pid.h>
|
|
||||||
|
|
||||||
#include "../lib/kstrtox.h"
|
#include "../lib/kstrtox.h"
|
||||||
|
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
#include <asm/processor.h>
|
#include <asm/processor.h>
|
||||||
|
|
||||||
#ifdef CONFIG_X86
|
|
||||||
#include <asm/nmi.h>
|
|
||||||
#include <asm/io.h>
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_RT_MUTEXES
|
|
||||||
#include <linux/rtmutex.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* shared constants to be used in various sysctls */
|
/* shared constants to be used in various sysctls */
|
||||||
const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 };
|
const int sysctl_vals[] = { 0, 1, 2, 3, 4, 100, 200, 1000, 3000, INT_MAX, 65535, -1 };
|
||||||
EXPORT_SYMBOL(sysctl_vals);
|
EXPORT_SYMBOL(sysctl_vals);
|
||||||
@ -736,49 +695,6 @@ int proc_douintvec(const struct ctl_table *table, int write, void *buffer,
|
|||||||
do_proc_douintvec_conv, NULL);
|
do_proc_douintvec_conv, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Taint values can only be increased
|
|
||||||
* This means we can safely use a temporary.
|
|
||||||
*/
|
|
||||||
static int proc_taint(const struct ctl_table *table, int write,
|
|
||||||
void *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
|
||||||
struct ctl_table t;
|
|
||||||
unsigned long tmptaint = get_taint();
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if (write && !capable(CAP_SYS_ADMIN))
|
|
||||||
return -EPERM;
|
|
||||||
|
|
||||||
t = *table;
|
|
||||||
t.data = &tmptaint;
|
|
||||||
err = proc_doulongvec_minmax(&t, write, buffer, lenp, ppos);
|
|
||||||
if (err < 0)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
if (write) {
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* If we are relying on panic_on_taint not producing
|
|
||||||
* false positives due to userspace input, bail out
|
|
||||||
* before setting the requested taint flags.
|
|
||||||
*/
|
|
||||||
if (panic_on_taint_nousertaint && (tmptaint & panic_on_taint))
|
|
||||||
return -EINVAL;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Poor man's atomic or. Not worth adding a primitive
|
|
||||||
* to everyone's atomic.h for this
|
|
||||||
*/
|
|
||||||
for (i = 0; i < TAINT_FLAGS_COUNT; i++)
|
|
||||||
if ((1UL << i) & tmptaint)
|
|
||||||
add_taint(i, LOCKDEP_STILL_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* struct do_proc_dointvec_minmax_conv_param - proc_dointvec_minmax() range checking structure
|
* struct do_proc_dointvec_minmax_conv_param - proc_dointvec_minmax() range checking structure
|
||||||
* @min: pointer to minimum allowable value
|
* @min: pointer to minimum allowable value
|
||||||
@ -968,26 +884,6 @@ int proc_dou8vec_minmax(const struct ctl_table *table, int write,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
|
EXPORT_SYMBOL_GPL(proc_dou8vec_minmax);
|
||||||
|
|
||||||
#ifdef CONFIG_MAGIC_SYSRQ
|
|
||||||
static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
|
|
||||||
void *buffer, size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
|
||||||
int tmp, ret;
|
|
||||||
|
|
||||||
tmp = sysrq_mask();
|
|
||||||
|
|
||||||
ret = __do_proc_dointvec(&tmp, table, write, buffer,
|
|
||||||
lenp, ppos, NULL, NULL);
|
|
||||||
if (ret || !write)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
if (write)
|
|
||||||
sysrq_toggle_support(tmp);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int __do_proc_doulongvec_minmax(void *data,
|
static int __do_proc_doulongvec_minmax(void *data,
|
||||||
const struct ctl_table *table, int write,
|
const struct ctl_table *table, int write,
|
||||||
void *buffer, size_t *lenp, loff_t *ppos,
|
void *buffer, size_t *lenp, loff_t *ppos,
|
||||||
@ -1292,28 +1188,6 @@ int proc_dointvec_ms_jiffies(const struct ctl_table *table, int write, void *buf
|
|||||||
do_proc_dointvec_ms_jiffies_conv, NULL);
|
do_proc_dointvec_ms_jiffies_conv, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int proc_do_cad_pid(const struct ctl_table *table, int write, void *buffer,
|
|
||||||
size_t *lenp, loff_t *ppos)
|
|
||||||
{
|
|
||||||
struct pid *new_pid;
|
|
||||||
pid_t tmp;
|
|
||||||
int r;
|
|
||||||
|
|
||||||
tmp = pid_vnr(cad_pid);
|
|
||||||
|
|
||||||
r = __do_proc_dointvec(&tmp, table, write, buffer,
|
|
||||||
lenp, ppos, NULL, NULL);
|
|
||||||
if (r || !write)
|
|
||||||
return r;
|
|
||||||
|
|
||||||
new_pid = find_get_pid(tmp);
|
|
||||||
if (!new_pid)
|
|
||||||
return -ESRCH;
|
|
||||||
|
|
||||||
put_pid(xchg(&cad_pid, new_pid));
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* proc_do_large_bitmap - read/write from/to a large bitmap
|
* proc_do_large_bitmap - read/write from/to a large bitmap
|
||||||
* @table: the sysctl table
|
* @table: the sysctl table
|
||||||
@ -1580,14 +1454,8 @@ int proc_do_static_key(const struct ctl_table *table, int write,
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct ctl_table kern_table[] = {
|
static const struct ctl_table sysctl_subsys_table[] = {
|
||||||
#ifdef CONFIG_PROC_SYSCTL
|
#ifdef CONFIG_PROC_SYSCTL
|
||||||
{
|
|
||||||
.procname = "tainted",
|
|
||||||
.maxlen = sizeof(long),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_taint,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.procname = "sysctl_writes_strict",
|
.procname = "sysctl_writes_strict",
|
||||||
.data = &sysctl_writes_strict,
|
.data = &sysctl_writes_strict,
|
||||||
@ -1598,95 +1466,6 @@ static const struct ctl_table kern_table[] = {
|
|||||||
.extra2 = SYSCTL_ONE,
|
.extra2 = SYSCTL_ONE,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_PARISC
|
|
||||||
{
|
|
||||||
.procname = "soft-power",
|
|
||||||
.data = &pwrsw_enabled,
|
|
||||||
.maxlen = sizeof (int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
|
|
||||||
{
|
|
||||||
.procname = "unaligned-trap",
|
|
||||||
.data = &unaligned_enabled,
|
|
||||||
.maxlen = sizeof (int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_MODULES
|
|
||||||
{
|
|
||||||
.procname = "modprobe",
|
|
||||||
.data = &modprobe_path,
|
|
||||||
.maxlen = KMOD_PATH_LEN,
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dostring,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.procname = "modules_disabled",
|
|
||||||
.data = &modules_disabled,
|
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
/* only handle a transition from default "0" to "1" */
|
|
||||||
.proc_handler = proc_dointvec_minmax,
|
|
||||||
.extra1 = SYSCTL_ONE,
|
|
||||||
.extra2 = SYSCTL_ONE,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_UEVENT_HELPER
|
|
||||||
{
|
|
||||||
.procname = "hotplug",
|
|
||||||
.data = &uevent_helper,
|
|
||||||
.maxlen = UEVENT_HELPER_PATH_LEN,
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dostring,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_MAGIC_SYSRQ
|
|
||||||
{
|
|
||||||
.procname = "sysrq",
|
|
||||||
.data = NULL,
|
|
||||||
.maxlen = sizeof (int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = sysrq_sysctl_handler,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_PROC_SYSCTL
|
|
||||||
{
|
|
||||||
.procname = "cad_pid",
|
|
||||||
.data = NULL,
|
|
||||||
.maxlen = sizeof (int),
|
|
||||||
.mode = 0600,
|
|
||||||
.proc_handler = proc_do_cad_pid,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
.procname = "threads-max",
|
|
||||||
.data = NULL,
|
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = sysctl_max_threads,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.procname = "overflowuid",
|
|
||||||
.data = &overflowuid,
|
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec_minmax,
|
|
||||||
.extra1 = SYSCTL_ZERO,
|
|
||||||
.extra2 = SYSCTL_MAXOLDUID,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.procname = "overflowgid",
|
|
||||||
.data = &overflowgid,
|
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec_minmax,
|
|
||||||
.extra1 = SYSCTL_ZERO,
|
|
||||||
.extra2 = SYSCTL_MAXOLDUID,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
.procname = "ngroups_max",
|
.procname = "ngroups_max",
|
||||||
.data = (void *)&ngroups_max,
|
.data = (void *)&ngroups_max,
|
||||||
@ -1701,20 +1480,10 @@ static const struct ctl_table kern_table[] = {
|
|||||||
.mode = 0444,
|
.mode = 0444,
|
||||||
.proc_handler = proc_dointvec,
|
.proc_handler = proc_dointvec,
|
||||||
},
|
},
|
||||||
#if (defined(CONFIG_X86_32) || defined(CONFIG_PARISC)) && \
|
#ifdef CONFIG_SYSCTL_ARCH_UNALIGN_ALLOW
|
||||||
defined(CONFIG_DEBUG_STACKOVERFLOW)
|
|
||||||
{
|
{
|
||||||
.procname = "panic_on_stackoverflow",
|
.procname = "unaligned-trap",
|
||||||
.data = &sysctl_panic_on_stackoverflow,
|
.data = &unaligned_enabled,
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#if defined(CONFIG_MMU)
|
|
||||||
{
|
|
||||||
.procname = "randomize_va_space",
|
|
||||||
.data = &randomize_va_space,
|
|
||||||
.maxlen = sizeof(int),
|
.maxlen = sizeof(int),
|
||||||
.mode = 0644,
|
.mode = 0644,
|
||||||
.proc_handler = proc_dointvec,
|
.proc_handler = proc_dointvec,
|
||||||
@ -1729,40 +1498,11 @@ static const struct ctl_table kern_table[] = {
|
|||||||
.proc_handler = proc_dointvec,
|
.proc_handler = proc_dointvec,
|
||||||
},
|
},
|
||||||
#endif
|
#endif
|
||||||
#ifdef CONFIG_RT_MUTEXES
|
|
||||||
{
|
|
||||||
.procname = "max_lock_depth",
|
|
||||||
.data = &max_lock_depth,
|
|
||||||
.maxlen = sizeof(int),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
#ifdef CONFIG_TREE_RCU
|
|
||||||
{
|
|
||||||
.procname = "panic_on_rcu_stall",
|
|
||||||
.data = &sysctl_panic_on_rcu_stall,
|
|
||||||
.maxlen = sizeof(sysctl_panic_on_rcu_stall),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec_minmax,
|
|
||||||
.extra1 = SYSCTL_ZERO,
|
|
||||||
.extra2 = SYSCTL_ONE,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
.procname = "max_rcu_stall_to_panic",
|
|
||||||
.data = &sysctl_max_rcu_stall_to_panic,
|
|
||||||
.maxlen = sizeof(sysctl_max_rcu_stall_to_panic),
|
|
||||||
.mode = 0644,
|
|
||||||
.proc_handler = proc_dointvec_minmax,
|
|
||||||
.extra1 = SYSCTL_ONE,
|
|
||||||
.extra2 = SYSCTL_INT_MAX,
|
|
||||||
},
|
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
int __init sysctl_init_bases(void)
|
int __init sysctl_init_bases(void)
|
||||||
{
|
{
|
||||||
register_sysctl_init("kernel", kern_table);
|
register_sysctl_init("kernel", sysctl_subsys_table);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -826,3 +826,23 @@ static int __init kobject_uevent_init(void)
|
|||||||
|
|
||||||
postcore_initcall(kobject_uevent_init);
|
postcore_initcall(kobject_uevent_init);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CONFIG_UEVENT_HELPER
|
||||||
|
static const struct ctl_table uevent_helper_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "hotplug",
|
||||||
|
.data = &uevent_helper,
|
||||||
|
.maxlen = UEVENT_HELPER_PATH_LEN,
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dostring,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_uevent_helper_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", uevent_helper_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
postcore_initcall(init_uevent_helper_sysctl);
|
||||||
|
#endif
|
||||||
|
18
mm/memory.c
18
mm/memory.c
@ -125,6 +125,24 @@ int randomize_va_space __read_mostly =
|
|||||||
2;
|
2;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static const struct ctl_table mmu_sysctl_table[] = {
|
||||||
|
{
|
||||||
|
.procname = "randomize_va_space",
|
||||||
|
.data = &randomize_va_space,
|
||||||
|
.maxlen = sizeof(int),
|
||||||
|
.mode = 0644,
|
||||||
|
.proc_handler = proc_dointvec,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
static int __init init_mm_sysctl(void)
|
||||||
|
{
|
||||||
|
register_sysctl_init("kernel", mmu_sysctl_table);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
subsys_initcall(init_mm_sysctl);
|
||||||
|
|
||||||
#ifndef arch_wants_old_prefaulted_pte
|
#ifndef arch_wants_old_prefaulted_pte
|
||||||
static inline bool arch_wants_old_prefaulted_pte(void)
|
static inline bool arch_wants_old_prefaulted_pte(void)
|
||||||
{
|
{
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/gawk -f
|
#!/usr/bin/env -S gawk -f
|
||||||
# SPDX-License-Identifier: GPL-2.0
|
# SPDX-License-Identifier: GPL-2.0
|
||||||
|
|
||||||
# Script to check sysctl documentation against source files
|
# Script to check sysctl documentation against source files
|
||||||
@ -13,10 +13,22 @@
|
|||||||
# Specify -vdebug=1 to see debugging information
|
# Specify -vdebug=1 to see debugging information
|
||||||
|
|
||||||
BEGIN {
|
BEGIN {
|
||||||
if (!table) {
|
if (!table) {
|
||||||
print "Please specify the table to look for using the table variable" > "/dev/stderr"
|
print "Please specify the table to look for using the table variable" > "/dev/stderr"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Documentation title skiplist
|
||||||
|
skiplist[0] = "^Documentation for"
|
||||||
|
skiplist[1] = "Network core options$"
|
||||||
|
skiplist[2] = "POSIX message queues filesystem$"
|
||||||
|
skiplist[3] = "Configuration options"
|
||||||
|
skiplist[4] = ". /proc/sys/fs"
|
||||||
|
skiplist[5] = "^Introduction$"
|
||||||
|
skiplist[6] = "^seccomp$"
|
||||||
|
skiplist[7] = "^pty$"
|
||||||
|
skiplist[8] = "^firmware_config$"
|
||||||
|
skiplist[9] = "^random$"
|
||||||
}
|
}
|
||||||
|
|
||||||
# The following globals are used:
|
# The following globals are used:
|
||||||
@ -31,124 +43,132 @@ BEGIN {
|
|||||||
|
|
||||||
# Remove punctuation from the given value
|
# Remove punctuation from the given value
|
||||||
function trimpunct(value) {
|
function trimpunct(value) {
|
||||||
while (value ~ /^["&]/) {
|
while (value ~ /^["&]/) {
|
||||||
value = substr(value, 2)
|
value = substr(value, 2)
|
||||||
}
|
}
|
||||||
while (value ~ /[]["&,}]$/) {
|
while (value ~ /[]["&,}]$/) {
|
||||||
value = substr(value, 1, length(value) - 1)
|
value = substr(value, 1, length(value) - 1)
|
||||||
}
|
}
|
||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
# Print the information for the given entry
|
# Print the information for the given entry
|
||||||
function printentry(entry) {
|
function printentry(entry) {
|
||||||
seen[entry]++
|
seen[entry]++
|
||||||
printf "* %s from %s", entry, file[entry]
|
printf "* %s from %s", entry, file[entry]
|
||||||
if (documented[entry]) {
|
if (documented[entry]) {
|
||||||
printf " (documented)"
|
printf " (documented)"
|
||||||
}
|
}
|
||||||
print ""
|
print ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Stage 1: build the list of documented entries
|
# Stage 1: build the list of documented entries
|
||||||
FNR == NR && /^=+$/ {
|
FNR == NR && /^=+$/ {
|
||||||
if (prevline ~ /Documentation for/) {
|
for (i in skiplist) {
|
||||||
# This is the main title
|
if (prevline ~ skiplist[i]) {
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# The previous line is a section title, parse it
|
# The previous line is a section title, parse it
|
||||||
$0 = prevline
|
$0 = prevline
|
||||||
if (debug) print "Parsing " $0
|
if (debug) print "Parsing " $0
|
||||||
inbrackets = 0
|
inbrackets = 0
|
||||||
for (i = 1; i <= NF; i++) {
|
for (i = 1; i <= NF; i++) {
|
||||||
if (length($i) == 0) {
|
if (length($i) == 0) {
|
||||||
continue
|
continue
|
||||||
|
}
|
||||||
|
if (!inbrackets && substr($i, 1, 1) == "(") {
|
||||||
|
inbrackets = 1
|
||||||
|
}
|
||||||
|
if (!inbrackets) {
|
||||||
|
token = trimpunct($i)
|
||||||
|
if (length(token) > 0 && token != "and") {
|
||||||
|
if (debug) print trimpunct($i)
|
||||||
|
documented[trimpunct($i)]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (inbrackets && substr($i, length($i), 1) == ")") {
|
||||||
|
inbrackets = 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!inbrackets && substr($i, 1, 1) == "(") {
|
|
||||||
inbrackets = 1
|
|
||||||
}
|
|
||||||
if (!inbrackets) {
|
|
||||||
token = trimpunct($i)
|
|
||||||
if (length(token) > 0 && token != "and") {
|
|
||||||
if (debug) print trimpunct($i)
|
|
||||||
documented[trimpunct($i)]++
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (inbrackets && substr($i, length($i), 1) == ")") {
|
|
||||||
inbrackets = 0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FNR == NR {
|
FNR == NR {
|
||||||
prevline = $0
|
prevline = $0
|
||||||
next
|
next
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# Stage 2: process each file and find all sysctl tables
|
# Stage 2: process each file and find all sysctl tables
|
||||||
BEGINFILE {
|
BEGINFILE {
|
||||||
delete entries
|
delete entries
|
||||||
curtable = ""
|
curtable = ""
|
||||||
curentry = ""
|
curentry = ""
|
||||||
delete vars
|
delete vars
|
||||||
if (debug) print "Processing file " FILENAME
|
if (debug) print "Processing file " FILENAME
|
||||||
}
|
}
|
||||||
|
|
||||||
/^static( const)? struct ctl_table/ {
|
/^static( const)? struct ctl_table/ {
|
||||||
match($0, /static( const)? struct ctl_table ([^][]+)/, tables)
|
match($0, /static( const)? struct ctl_table ([^][]+)/, tables)
|
||||||
curtable = tables[2]
|
curtable = tables[2]
|
||||||
if (debug) print "Processing table " curtable
|
if (debug) print "Processing table " curtable
|
||||||
}
|
}
|
||||||
|
|
||||||
/^};$/ {
|
/^};$/ {
|
||||||
curtable = ""
|
curtable = ""
|
||||||
curentry = ""
|
curentry = ""
|
||||||
delete vars
|
delete vars
|
||||||
}
|
}
|
||||||
|
|
||||||
curtable && /\.procname[\t ]*=[\t ]*".+"/ {
|
curtable && /\.procname[\t ]*=[\t ]*".+"/ {
|
||||||
match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names)
|
match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names)
|
||||||
curentry = names[1]
|
curentry = names[1]
|
||||||
if (debug) print "Adding entry " curentry " to table " curtable
|
if (debug) print "Adding entry " curentry " to table " curtable
|
||||||
entries[curtable][curentry]++
|
entries[curtable][curentry]++
|
||||||
file[curentry] = FILENAME
|
file[curentry] = FILENAME
|
||||||
|
}
|
||||||
|
|
||||||
|
curtable && /UCOUNT_ENTRY.*/ {
|
||||||
|
match($0, /UCOUNT_ENTRY\("([^"]+)"\)/, names)
|
||||||
|
curentry = names[1]
|
||||||
|
if (debug) print "Adding entry " curentry " to table " curtable
|
||||||
|
entries[curtable][curentry]++
|
||||||
|
file[curentry] = FILENAME
|
||||||
}
|
}
|
||||||
|
|
||||||
/register_sysctl.*/ {
|
/register_sysctl.*/ {
|
||||||
match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables)
|
match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables)
|
||||||
if (debug) print "Registering table " tables[3] " at " tables[2]
|
if (debug) print "Registering table " tables[3] " at " tables[2]
|
||||||
if (tables[2] == table) {
|
if (tables[2] == table) {
|
||||||
for (entry in entries[tables[3]]) {
|
for (entry in entries[tables[3]]) {
|
||||||
printentry(entry)
|
printentry(entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/kmemdup.*/ {
|
/kmemdup.*/ {
|
||||||
match($0, /([^ \t]+) *= *kmemdup\(([^,]+) *,/, names)
|
match($0, /([^ \t]+) *= *kmemdup\(([^,]+) *,/, names)
|
||||||
if (debug) print "Found variable " names[1] " for table " names[2]
|
if (debug) print "Found variable " names[1] " for table " names[2]
|
||||||
if (names[2] in entries) {
|
if (names[2] in entries) {
|
||||||
vars[names[1]] = names[2]
|
vars[names[1]] = names[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/__register_sysctl_table.*/ {
|
/__register_sysctl_table.*/ {
|
||||||
match($0, /__register_sysctl_table\([^,]+, *"([^"]+)" *, *([^,]+)/, tables)
|
match($0, /__register_sysctl_table\([^,]+, *"([^"]+)" *, *([^,]+)/, tables)
|
||||||
if (debug) print "Registering variable table " tables[2] " at " tables[1]
|
if (debug) print "Registering variable table " tables[2] " at " tables[1]
|
||||||
if (tables[1] == table && tables[2] in vars) {
|
if (tables[1] == table && tables[2] in vars) {
|
||||||
for (entry in entries[vars[tables[2]]]) {
|
for (entry in entries[vars[tables[2]]]) {
|
||||||
printentry(entry)
|
printentry(entry)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
END {
|
END {
|
||||||
for (entry in documented) {
|
for (entry in documented) {
|
||||||
if (!seen[entry]) {
|
if (!seen[entry])
|
||||||
print "No implementation for " entry
|
print "No implementation for " entry
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
# SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1
|
# SPDX-License-Identifier: GPL-2.0-or-later OR copyleft-next-0.3.1
|
||||||
# Copyright (C) 2017 Luis R. Rodriguez <mcgrof@kernel.org>
|
# Copyright (C) 2017 Luis R. Rodriguez <mcgrof@kernel.org>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user