Skip to content

Commit 4b290aa

Browse files
committed
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 ...
2 parents a26321e + ffc137c commit 4b290aa

File tree

22 files changed

+445
-387
lines changed

22 files changed

+445
-387
lines changed

Documentation/admin-guide/sysctl/kernel.rst

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1014,30 +1014,26 @@ perf_user_access (arm64 and riscv only)
10141014

10151015
Controls user space access for reading perf event counters.
10161016

1017-
arm64
1018-
=====
1019-
1020-
The default value is 0 (access disabled).
1017+
* for arm64
1018+
The default value is 0 (access disabled).
10211019

1022-
When set to 1, user space can read performance monitor counter registers
1023-
directly.
1020+
When set to 1, user space can read performance monitor counter registers
1021+
directly.
10241022

1025-
See Documentation/arch/arm64/perf.rst for more information.
1026-
1027-
riscv
1028-
=====
1023+
See Documentation/arch/arm64/perf.rst for more information.
10291024

1030-
When set to 0, user space access is disabled.
1025+
* for riscv
1026+
When set to 0, user space access is disabled.
10311027

1032-
The default value is 1, user space can read performance monitor counter
1033-
registers through perf, any direct access without perf intervention will trigger
1034-
an illegal instruction.
1028+
The default value is 1, user space can read performance monitor counter
1029+
registers through perf, any direct access without perf intervention will trigger
1030+
an illegal instruction.
10351031

1036-
When set to 2, which enables legacy mode (user space has direct access to cycle
1037-
and insret CSRs only). Note that this legacy value is deprecated and will be
1038-
removed once all user space applications are fixed.
1032+
When set to 2, which enables legacy mode (user space has direct access to cycle
1033+
and insret CSRs only). Note that this legacy value is deprecated and will be
1034+
removed once all user space applications are fixed.
10391035

1040-
Note that the time CSR is always directly accessible to all modes.
1036+
Note that the time CSR is always directly accessible to all modes.
10411037

10421038
pid_max
10431039
=======

Documentation/admin-guide/sysctl/vm.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -465,8 +465,8 @@ The minimum value is 1 (1/1 -> 100%). The value less than 1 completely
465465
disables protection of the pages.
466466

467467

468-
max_map_count:
469-
==============
468+
max_map_count
469+
=============
470470

471471
This file contains the maximum number of memory map areas a process
472472
may have. Memory map areas are used as a side-effect of calling
@@ -495,8 +495,8 @@ memory allocations.
495495
The default value depends on CONFIG_MEM_ALLOC_PROFILING_ENABLED_BY_DEFAULT.
496496

497497

498-
memory_failure_early_kill:
499-
==========================
498+
memory_failure_early_kill
499+
=========================
500500

501501
Control how to kill processes when uncorrected memory error (typically
502502
a 2bit error in a memory module) is detected in the background by hardware

drivers/parisc/power.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,25 @@ static struct task_struct *power_task;
8383
#define SYSCTL_FILENAME "sys/kernel/power"
8484

8585
/* soft power switch enabled/disabled */
86-
int pwrsw_enabled __read_mostly = 1;
86+
static int pwrsw_enabled __read_mostly = 1;
87+
88+
static const struct ctl_table power_sysctl_table[] = {
89+
{
90+
.procname = "soft-power",
91+
.data = &pwrsw_enabled,
92+
.maxlen = sizeof(int),
93+
.mode = 0644,
94+
.proc_handler = proc_dointvec,
95+
},
96+
};
97+
98+
static int __init init_power_sysctl(void)
99+
{
100+
register_sysctl_init("kernel", power_sysctl_table);
101+
return 0;
102+
}
103+
104+
arch_initcall(init_power_sysctl);
87105

88106
/* main kernel thread worker. It polls the button state */
89107
static int kpowerswd(void *param)

drivers/tty/sysrq.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,6 +1120,47 @@ int sysrq_toggle_support(int enable_mask)
11201120
}
11211121
EXPORT_SYMBOL_GPL(sysrq_toggle_support);
11221122

1123+
static int sysrq_sysctl_handler(const struct ctl_table *table, int write,
1124+
void *buffer, size_t *lenp, loff_t *ppos)
1125+
{
1126+
int tmp, ret;
1127+
struct ctl_table t = *table;
1128+
1129+
tmp = sysrq_mask();
1130+
t.data = &tmp;
1131+
1132+
/*
1133+
* Behaves like do_proc_dointvec as t does not have min nor max.
1134+
*/
1135+
ret = proc_dointvec_minmax(&t, write, buffer, lenp, ppos);
1136+
1137+
if (ret || !write)
1138+
return ret;
1139+
1140+
if (write)
1141+
sysrq_toggle_support(tmp);
1142+
1143+
return 0;
1144+
}
1145+
1146+
static const struct ctl_table sysrq_sysctl_table[] = {
1147+
{
1148+
.procname = "sysrq",
1149+
.data = NULL,
1150+
.maxlen = sizeof(int),
1151+
.mode = 0644,
1152+
.proc_handler = sysrq_sysctl_handler,
1153+
},
1154+
};
1155+
1156+
static int __init init_sysrq_sysctl(void)
1157+
{
1158+
register_sysctl_init("kernel", sysrq_sysctl_table);
1159+
return 0;
1160+
}
1161+
1162+
subsys_initcall(init_sysrq_sysctl);
1163+
11231164
static int __sysrq_swap_key_ops(u8 key, const struct sysrq_key_op *insert_op_p,
11241165
const struct sysrq_key_op *remove_op_p)
11251166
{

include/linux/kmod.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,7 @@
1414
#include <linux/workqueue.h>
1515
#include <linux/sysctl.h>
1616

17-
#define KMOD_PATH_LEN 256
18-
1917
#ifdef CONFIG_MODULES
20-
extern char modprobe_path[]; /* for sysctl */
2118
/* modprobe exit status on success, -ve on error. Return value
2219
* usually useless though. */
2320
extern __printf(2, 3)

include/linux/module.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,6 @@ struct notifier_block;
304304

305305
#ifdef CONFIG_MODULES
306306

307-
extern int modules_disabled; /* for sysctl */
308307
/* Get/put a kernel symbol (calls must be symmetric) */
309308
void *__symbol_get(const char *symbol);
310309
void *__symbol_get_gpl(const char *symbol);

include/linux/panic.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ extern int panic_on_warn;
2525
extern unsigned long panic_on_taint;
2626
extern bool panic_on_taint_nousertaint;
2727

28-
extern int sysctl_panic_on_rcu_stall;
29-
extern int sysctl_max_rcu_stall_to_panic;
3028
extern int sysctl_panic_on_stackoverflow;
3129

3230
extern bool crash_kexec_post_notifiers;

include/linux/rtmutex.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <linux/rbtree_types.h>
1919
#include <linux/spinlock_types_raw.h>
2020

21-
extern int max_lock_depth; /* for sysctl */
21+
extern int max_lock_depth;
2222

2323
struct rt_mutex_base {
2424
raw_spinlock_t wait_lock;

include/linux/sysctl.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,9 +242,7 @@ int do_proc_douintvec(const struct ctl_table *table, int write,
242242
int write, void *data),
243243
void *data);
244244

245-
extern int pwrsw_enabled;
246245
extern int unaligned_enabled;
247-
extern int unaligned_dump_stack;
248246
extern int no_unaligned_warning;
249247

250248
#else /* CONFIG_SYSCTL */
@@ -285,7 +283,4 @@ static inline bool sysctl_is_alias(char *param)
285283
}
286284
#endif /* CONFIG_SYSCTL */
287285

288-
int sysctl_max_threads(const struct ctl_table *table, int write, void *buffer,
289-
size_t *lenp, loff_t *ppos);
290-
291286
#endif /* _LINUX_SYSCTL_H */

kernel/fork.c

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3219,7 +3219,7 @@ int unshare_files(void)
32193219
return 0;
32203220
}
32213221

3222-
int sysctl_max_threads(const struct ctl_table *table, int write,
3222+
static int sysctl_max_threads(const struct ctl_table *table, int write,
32233223
void *buffer, size_t *lenp, loff_t *ppos)
32243224
{
32253225
struct ctl_table t;
@@ -3241,3 +3241,21 @@ int sysctl_max_threads(const struct ctl_table *table, int write,
32413241

32423242
return 0;
32433243
}
3244+
3245+
static const struct ctl_table fork_sysctl_table[] = {
3246+
{
3247+
.procname = "threads-max",
3248+
.data = NULL,
3249+
.maxlen = sizeof(int),
3250+
.mode = 0644,
3251+
.proc_handler = sysctl_max_threads,
3252+
},
3253+
};
3254+
3255+
static int __init init_fork_sysctl(void)
3256+
{
3257+
register_sysctl_init("kernel", fork_sysctl_table);
3258+
return 0;
3259+
}
3260+
3261+
subsys_initcall(init_fork_sysctl);

0 commit comments

Comments
 (0)