sysctl: treewide: constify the ctl_table argument of proc_handlers
Subsystems (52)
PATCH v2 1/1 sysctl: treewide: constify the ctl_table argument of proc_handlers
Adapt the proc_hander function signature to make it clear that handlers are not supposed to modify their ctl_table argument.
This is also a prerequisite to moving the static ctl_table structs into read-only data.
The patch was mostly generated by coccinelle with the following script:
@@
identifier func, ctl, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *ctl,
+ const struct ctl_table *ctl,
int write, void *buffer, size_t *lenp, loff_t *ppos)
{ ... }In addition to the scripted changes some other changes are done:
* The "typedef proc_handler" in include/linux/sysctl.h is changed to use the "const ctl_table".
* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
* kernel/watchdog.c: proc_watchdog_common()
This is called from a proc_handler itself and is als calling back into another proc_handler, making it necessary to change it as part of the proc_handler migration.
No functional change.
---
This patch is meant to be applied directly by Linus at the end of the merge-window for v6.11.
It is based on next-20240618.
These changes are done as a single commit as all the different proc_handlers and struct ctl_table are tightly linked together. Avoiding a single cut-over patch would have meant a lengthy transition phase, including a lot of code churn and complications in the sysctl core.
Several other preparation patches are prerequisites for this patch and are not yet part of v6.10-rc1 but are currently in -next and are expected to be submitted during the v6.11 merge-window.
From the mm tree:
* mm/hugetlb: constify ctl_table arguments of utility functions
From the BPF tree:
* bpf: constify member bpf_sysctl_kern:: Table
From the net tree:
* ipvs: constify ctl_table arguments of utility functions
* net/ipv6/ndisc: constify ctl_table arguments of utility function
* net/ipv6/addrconf: constify ctl_table arguments of utility functions
* net/ipv4/sysctl: constify ctl_table arguments of utility functions
* net/neighbour: constify ctl_table arguments of utility function
From the sysctl tree:
* utsname: constify ctl_table arguments of utility function
* sysctl: constify ctl_table arguments of utility function
Motivation
==========
Moving structures containing function pointers into unmodifiable .rodata prevents attackers or bugs from corrupting and diverting those pointers.
Also the "struct ctl_table" exposed by the sysctl core were never meant to be mutated by users.
For this goal changes to both the sysctl core and "const" qualifiers for various sysctl APIs are necessary.
Full Process
============
* Drop ctl_table modifications from the sysctl core ([0], in mainline)
* Constify arguments to ctl_table_root::{set_ownership,permissions}
([1], in mainline)
* Migrate users of "ctl_table_header::ctl_table_arg" to "const".
(in mainline)
* Afterwards convert "ctl_table_header::ctl_table_arg" itself to const.
(in mainline)
* Prepare helpers used to implement proc_handlers throughout the tree to use "const struct ctl_table *". ([2], done, in mainline or -next)
* Afterwards switch over all proc_handlers callbacks to use
"const struct ctl_table *" in one commit. (this patch)
Only custom handlers will be affected, the big commit avoids a
disruptive and messy transition phase.
* Switch over the internals of the sysctl core to "const struct ctl_table *" (to be done)
* Switch include/linux/sysctl.h to "const struct ctl_table *" (to be done)
* Transition instances of "struct ctl_table" through the tree to const (to be done)
A work-in-progress view containing all the outlined changes can be found at
https://git.sr.ht/~t-8ch/linux sysctl-constfy
[0] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/[email protected]/
---
Changes in v2:
- Drop notes about manual seccomp.c fixups which are not actually
present anymore.
- Send patch to LKML.
- Rebase onto next-20240618 (adapt proc_fib_multipath_hash_seed)
- Link to v1: https://lore.kernel.org/r/[email protected]
--- arch/arm64/kernel/armv8_deprecated.c | 2 +- arch/arm64/kernel/fpsimd.c | 2 +- arch/s390/appldata/appldata_base.c | 10 ++--- arch/s390/kernel/debug.c | 2 +- arch/s390/kernel/topology.c | 2 +- arch/s390/mm/cmm.c | 6 +-- arch/x86/kernel/itmt.c | 2 +- drivers/cdrom/cdrom.c | 4 +- drivers/char/random.c | 6 +-- drivers/macintosh/mac_hid.c | 2 +- drivers/net/vrf.c | 2 +- drivers/parport/procfs.c | 12 +++--- drivers/perf/arm_pmuv3.c | 4 +- drivers/perf/riscv_pmu_sbi.c | 2 +- fs/coredump.c | 2 +- fs/dcache.c | 4 +- fs/drop_caches.c | 2 +- fs/exec.c | 4 +- fs/file_table.c | 4 +- fs/fs-writeback.c | 2 +- fs/inode.c | 4 +- fs/pipe.c | 2 +- fs/quota/dquot.c | 2 +- fs/xfs/xfs_sysctl.c | 6 +-- include/linux/ftrace.h | 4 +- include/linux/mm.h | 8 ++-- include/linux/perf_event.h | 6 +-- include/linux/security.h | 2 +- include/linux/sysctl.h | 34 ++++++++-------- include/linux/vmstat.h | 6 +-- include/linux/writeback.h | 2 +- include/net/ndisc.h | 2 +- include/net/neighbour.h | 6 +-- include/net/netfilter/nf_hooks_lwtunnel.h | 2 +- ipc/ipc_sysctl.c | 8 ++-- kernel/bpf/syscall.c | 4 +- kernel/delayacct.c | 4 +- kernel/events/callchain.c | 2 +- kernel/events/core.c | 4 +- kernel/fork.c | 2 +- kernel/hung_task.c | 6 +-- kernel/kexec_core.c | 2 +- kernel/kprobes.c | 2 +- kernel/latencytop.c | 4 +- kernel/pid_namespace.c | 2 +- kernel/pid_sysctl.h | 2 +- kernel/printk/internal.h | 2 +- kernel/printk/printk.c | 2 +- kernel/printk/sysctl.c | 5 ++- kernel/sched/core.c | 8 ++-- kernel/sched/rt.c | 16 ++++---- kernel/sched/topology.c | 2 +- kernel/seccomp.c | 6 +-- kernel/stackleak.c | 2 +- kernel/sysctl.c | 68 +++++++++++++++---------------- kernel/time/timer.c | 2 +- kernel/trace/ftrace.c | 2 +- kernel/trace/trace.c | 2 +- kernel/trace/trace_events_user.c | 2 +- kernel/trace/trace_stack.c | 2 +- kernel/umh.c | 2 +- kernel/utsname_sysctl.c | 2 +- kernel/watchdog.c | 12 +++--- mm/compaction.c | 6 +-- mm/hugetlb.c | 8 ++-- mm/page-writeback.c | 18 ++++---- mm/page_alloc.c | 14 +++---- mm/util.c | 12 +++--- mm/vmstat.c | 4 +- net/bridge/br_netfilter_hooks.c | 2 +- net/core/neighbour.c | 18 ++++---- net/core/sysctl_net_core.c | 20 ++++----- net/ipv4/devinet.c | 6 +-- net/ipv4/route.c | 2 +- net/ipv4/sysctl_net_ipv4.c | 34 ++++++++-------- net/ipv6/addrconf.c | 19 +++++---- net/ipv6/ndisc.c | 2 +- net/ipv6/route.c | 2 +- net/ipv6/sysctl_net_ipv6.c | 4 +- net/mpls/af_mpls.c | 4 +- net/mptcp/ctrl.c | 4 +- net/netfilter/ipvs/ip_vs_ctl.c | 12 +++--- net/netfilter/nf_conntrack_standalone.c | 2 +- net/netfilter/nf_hooks_lwtunnel.c | 2 +- net/netfilter/nf_log.c | 2 +- net/phonet/sysctl.c | 2 +- net/rds/tcp.c | 4 +- net/sctp/sysctl.c | 32 +++++++-------- net/sunrpc/sysctl.c | 6 +-- net/sunrpc/xprtrdma/svc_rdma.c | 2 +- security/apparmor/lsm.c | 2 +- security/min_addr.c | 2 +- security/yama/yama_lsm.c | 2 +- 93 files changed, 296 insertions(+), 294 deletions(-)
arch/arm64/kernel/armv8_deprecated.c +1 -1
@@ -507,7 +507,7 @@ static int update_insn_emulation_mode(struct insn_emulation *insn,return ret; } -static int emulation_proc_handler (struct ctl_table *table,int write, +static int emulation_proc_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
arch/arm64/kernel/fpsimd.c +1 -1
@@ -535,7 +535,7 @@ static unsigned int find_supported_vector_length(enum vec_type type,#if defined(CONFIG_ARM64_SVE ) && defined(CONFIG_SYSCTL ) -static int vec_proc_do_default_vl (struct ctl_table *table,int write, +static int vec_proc_do_default_vl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct vl_info *info = table->extra1;
arch/s390/appldata/appldata_base.c +5 -5
@@ -46,9 +46,9 @@* /proc entries (sysctl) */ static const char appldata_proc_name[APPLDATA_PROC_NAME_LENGTH ] ="appldata" ; -static int appldata_timer_handler (struct ctl_table *ctl,int write, +static int appldata_timer_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -static int appldata_interval_handler (struct ctl_table *ctl,int write, +static int appldata_interval_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos);static struct ctl_table_header *appldata_sysctl_header;
@@ -199,7 +199,7 @@ static void __appldata_vtimer_setup(int cmd)* Start/Stop timer, show status of timer (0 = not active, 1 = active) */ static int -appldata_timer_handler (struct ctl_table *ctl,int write, +appldata_timer_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int timer_active = appldata_timer_active;
@@ -232,7 +232,7 @@ appldata_timer_handler(struct ctl_table *ctl, int write,* current timer interval. */ static int -appldata_interval_handler (struct ctl_table *ctl,int write, +appldata_interval_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int interval = appldata_interval;
@@ -262,7 +262,7 @@ appldata_interval_handler(struct ctl_table *ctl, int write,* monitoring (0 = not in process, 1 = in process) */ static int -appldata_generic_handler (struct ctl_table *ctl,int write, +appldata_generic_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct appldata_ops *ops =NULL , *tmp_ops;
arch/s390/kernel/debug.c +1 -1
@@ -954,7 +954,7 @@ static int debug_active = 1;* always allow read, allow write only if debug_stoppable is set or * if debug_active is already off */ -static int s390dbf_procactive (struct ctl_table *table,int write, +static int s390dbf_procactive (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {if (!write || debug_stoppable || !debug_active)
arch/s390/kernel/topology.c +1 -1
@@ -600,7 +600,7 @@ static int __init topology_setup(char *str) }early_param ("topology" , topology_setup); -static int topology_ctl_handler (struct ctl_table *ctl,int write, +static int topology_ctl_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int enabled =topology_is_enabled ();
arch/s390/mm/cmm.c +3 -3
@@ -243,7 +243,7 @@ static int cmm_skip_blanks(char *cp, char **endp)return str != cp; } -static int cmm_pages_handler (struct ctl_table *ctl,int write, +static int cmm_pages_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {long nr =cmm_get_pages ();
@@ -262,7 +262,7 @@ static int cmm_pages_handler(struct ctl_table *ctl, int write,return 0 ; } -static int cmm_timed_pages_handler (struct ctl_table *ctl,int write, +static int cmm_timed_pages_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -282,7 +282,7 @@ static int cmm_timed_pages_handler(struct ctl_table *ctl, int write,return 0 ; } -static int cmm_timeout_handler (struct ctl_table *ctl,int write, +static int cmm_timeout_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {char buf[64 ], *p;
arch/x86/kernel/itmt.c +1 -1
@@ -38,7 +38,7 @@ static bool __read_mostly sched_itmt_capable;*/ unsigned int __read_mostly sysctl_sched_itmt_enabled; -static int sched_itmt_update_handler (struct ctl_table *table,int write, +static int sched_itmt_update_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {unsigned int old_sysctl;
drivers/cdrom/cdrom.c +2 -2
@@ -3473,7 +3473,7 @@ static int cdrom_print_info(const char *header, int val, char *info,return 0 ; } -static int cdrom_sysctl_info (struct ctl_table *ctl,int write, +static int cdrom_sysctl_info (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int pos;
@@ -3586,7 +3586,7 @@ static void cdrom_update_settings(void)mutex_unlock (&cdrom_mutex); } -static int cdrom_sysctl_handler (struct ctl_table *ctl,int write, +static int cdrom_sysctl_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
drivers/char/random.c +3 -3
@@ -1604,7 +1604,7 @@ static u8 sysctl_bootid[UUID_SIZE];* UUID. The difference is in whether table->data is NULL; if it is, * then a new UUID is generated and returned to the user. */ -static int proc_do_uuid (struct ctl_table *table,int write,void *buf, +static int proc_do_uuid (const struct ctl_table *table,int write,void *buf,size_t *lenp,loff_t *ppos) {u8 tmp_uuid[UUID_SIZE ], *uuid;
@@ -1635,8 +1635,8 @@ static int proc_do_uuid(struct ctl_table *table, int write, void *buf, }/* The same as proc_dointvec, but writes don't change anything. */ -static int proc_do_rointvec (struct ctl_table *table,int write,void *buf, -size_t *lenp,loff_t *ppos) +static int proc_do_rointvec (const struct ctl_table *table,int write, +void *buf,size_t *lenp,loff_t *ppos) {return write ?0 :proc_dointvec (table,0 , buf, lenp, ppos); }
drivers/macintosh/mac_hid.c +1 -1
@@ -182,7 +182,7 @@ static void mac_hid_stop_emulation(void)mac_hid_destroy_emumouse (); } -static int mac_hid_toggle_emumouse (struct ctl_table *table,int write, +static int mac_hid_toggle_emumouse (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = table->data;
drivers/net/vrf.c +1 -1
@@ -1886,7 +1886,7 @@ static int vrf_strict_mode_change(struct vrf_map *vmap, bool new_mode)return res; } -static int vrf_shared_table_handler (struct ctl_table *table,int write, +static int vrf_shared_table_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = (struct net *)table->extra1;
drivers/parport/procfs.c +6 -6
@@ -33,7 +33,7 @@#define PARPORT_MIN_SPINTIME_VALUE 1#define PARPORT_MAX_SPINTIME_VALUE 1000 -static int do_active_device (struct ctl_table *table,int write, +static int do_active_device (const struct ctl_table *table,int write,void *result,size_t *lenp,loff_t *ppos) {struct parport *port = (struct parport *)table->extra1;
@@ -70,7 +70,7 @@ static int do_active_device(struct ctl_table *table, int write, }#ifdef CONFIG_PARPORT_1284 -static int do_autoprobe (struct ctl_table *table,int write, +static int do_autoprobe (const struct ctl_table *table,int write,void *result,size_t *lenp,loff_t *ppos) {struct parport_device_info *info = table->extra2;
@@ -113,7 +113,7 @@ static int do_autoprobe(struct ctl_table *table, int write, }#endif /* IEEE1284.3 support. */ -static int do_hardware_base_addr (struct ctl_table *table,int write, +static int do_hardware_base_addr (const struct ctl_table *table,int write,void *result,size_t *lenp,loff_t *ppos) {struct parport *port = (struct parport *)table->extra1;
@@ -140,7 +140,7 @@ static int do_hardware_base_addr(struct ctl_table *table, int write,return 0 ; } -static int do_hardware_irq (struct ctl_table *table,int write, +static int do_hardware_irq (const struct ctl_table *table,int write,void *result,size_t *lenp,loff_t *ppos) {struct parport *port = (struct parport *)table->extra1;
@@ -167,7 +167,7 @@ static int do_hardware_irq(struct ctl_table *table, int write,return 0 ; } -static int do_hardware_dma (struct ctl_table *table,int write, +static int do_hardware_dma (const struct ctl_table *table,int write,void *result,size_t *lenp,loff_t *ppos) {struct parport *port = (struct parport *)table->extra1;
@@ -194,7 +194,7 @@ static int do_hardware_dma(struct ctl_table *table, int write,return 0 ; } -static int do_hardware_modes (struct ctl_table *table,int write, +static int do_hardware_modes (const struct ctl_table *table,int write,void *result,size_t *lenp,loff_t *ppos) {struct parport *port = (struct parport *)table->extra1;
drivers/perf/arm_pmuv3.c +2 -2
@@ -1253,8 +1253,8 @@ static void armv8pmu_disable_user_access_ipi(void *unused)armv8pmu_disable_user_access (); } -static int armv8pmu_proc_user_access_handler (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int armv8pmu_proc_user_access_handler (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);if (ret || !write || sysctl_perf_user_access)
drivers/perf/riscv_pmu_sbi.c +1 -1
@@ -1242,7 +1242,7 @@ static void riscv_pmu_update_counter_access(void *info)csr_write (CSR_SCOUNTEREN ,0x2 ); } -static int riscv_pmu_proc_user_access_handler (struct ctl_table *table, +static int riscv_pmu_proc_user_access_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
fs/coredump.c +1 -1
@@ -991,7 +991,7 @@ void validate_coredump_safety(void) } } -static int proc_dostring_coredump (struct ctl_table *table,int write, +static int proc_dostring_coredump (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int error =proc_dostring (table, write, buffer, lenp, ppos);
fs/dcache.c +2 -2
@@ -174,8 +174,8 @@ static long get_nr_dentry_negative(void)return sum <0 ?0 : sum; } -static int proc_nr_dentry (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int proc_nr_dentry (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) { dentry_stat.nr_dentry =get_nr_dentry (); dentry_stat.nr_unused =get_nr_dentry_unused ();
fs/drop_caches.c +1 -1
@@ -48,7 +48,7 @@ static void drop_pagecache_sb(struct super_block *sb, void *unused)iput (toput_inode); } -int drop_caches_sysctl_handler (struct ctl_table *table,int write, +int drop_caches_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int ret;
fs/exec.c +2 -2
@@ -2173,8 +2173,8 @@ COMPAT_SYSCALL_DEFINE5(execveat, int, fd,#ifdef CONFIG_SYSCTL -static int proc_dointvec_minmax_coredump (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int proc_dointvec_minmax_coredump (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) {int error =proc_dointvec_minmax (table, write, buffer, lenp, ppos);
fs/file_table.c +2 -2
@@ -96,8 +96,8 @@ EXPORT_SYMBOL_GPL(get_max_files);/* * Handle nr_files sysctl */ -static int proc_nr_files (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int proc_nr_files (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) { files_stat.nr_files =get_nr_files ();return proc_doulongvec_minmax (table, write, buffer, lenp, ppos);
fs/fs-writeback.c +1 -1
@@ -2413,7 +2413,7 @@ static int __init start_dirtytime_writeback(void) }__initcall (start_dirtytime_writeback); -int dirtytime_interval_handler (struct ctl_table *table,int write, +int dirtytime_interval_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
fs/inode.c +2 -2
@@ -107,8 +107,8 @@ long get_nr_dirty_inodes(void)*/ static struct inodes_stat_t inodes_stat; -static int proc_nr_inodes (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int proc_nr_inodes (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) { inodes_stat.nr_inodes =get_nr_inodes (); inodes_stat.nr_unused =get_nr_inodes_unused ();
fs/pipe.c +1 -1
@@ -1469,7 +1469,7 @@ static int do_proc_dopipe_max_size_conv(unsigned long *lvalp,return 0 ; } -static int proc_dopipe_max_size (struct ctl_table *table,int write, +static int proc_dopipe_max_size (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { return do_proc_douintvec(table, write, buffer, lenp, ppos,
fs/quota/dquot.c +1 -1
@@ -2913,7 +2913,7 @@ const struct quotactl_ops dquot_quotactl_sysfile_ops = { };EXPORT_SYMBOL (dquot_quotactl_sysfile_ops); -static int do_proc_dqstats (struct ctl_table *table,int write, +static int do_proc_dqstats (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {unsigned int type = (unsigned long *)table->data - dqstats.stat;
fs/xfs/xfs_sysctl.c +3 -3
@@ -11,7 +11,7 @@ static struct ctl_table_header *xfs_table_header;#ifdef CONFIG_PROC_FS STATIC int xfs_stats_clear_proc_handler( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp,
@@ -31,7 +31,7 @@ xfs_stats_clear_proc_handler( STATIC int xfs_panic_mask_proc_handler( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp,
@@ -52,7 +52,7 @@ xfs_panic_mask_proc_handler( STATIC int xfs_deprecated_dointvec_minmax( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp,
include/linux/ftrace.h +2 -2
@@ -471,7 +471,7 @@ static inline void arch_ftrace_set_direct_caller(struct ftrace_regs *fregs,extern int stack_tracer_enabled; -int stack_trace_sysctl (struct ctl_table *table,int write,void *buffer, +int stack_trace_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);/* DO NOT MODIFY THIS VARIABLE DIRECTLY! */
@@ -1175,7 +1175,7 @@ extern int tracepoint_printk;extern void disable_trace_on_warning (void );extern int __disable_trace_on_warning; -int tracepoint_printk_sysctl (struct ctl_table *table,int write, +int tracepoint_printk_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);#else /* CONFIG_TRACING */
include/linux/mm.h +4 -4
@@ -204,11 +204,11 @@ extern int sysctl_overcommit_memory;extern int sysctl_overcommit_ratio;extern unsigned long sysctl_overcommit_kbytes; -int overcommit_ratio_handler (struct ctl_table *,int ,void *,size_t *, +int overcommit_ratio_handler (const struct ctl_table *,int ,void *,size_t *,loff_t *); -int overcommit_kbytes_handler (struct ctl_table *,int ,void *,size_t *, +int overcommit_kbytes_handler (const struct ctl_table *,int ,void *,size_t *,loff_t *); -int overcommit_policy_handler (struct ctl_table *,int ,void *,size_t *, +int overcommit_policy_handler (const struct ctl_table *,int ,void *,size_t *,loff_t *);#if defined(CONFIG_SPARSEMEM ) && !defined(CONFIG_SPARSEMEM_VMEMMAP )
@@ -3852,7 +3852,7 @@ extern bool process_shares_mm(struct task_struct *p, struct mm_struct *mm);#ifdef CONFIG_SYSCTL extern int sysctl_drop_caches; -int drop_caches_sysctl_handler (struct ctl_table *,int ,void *,size_t *, +int drop_caches_sysctl_handler (const struct ctl_table *,int ,void *,size_t *,loff_t *);#endif
include/linux/perf_event.h +3 -3
@@ -1587,11 +1587,11 @@ extern int sysctl_perf_cpu_time_max_percent;extern void perf_sample_event_took (u64 sample_len_ns); -int perf_event_max_sample_rate_handler (struct ctl_table *table,int write, +int perf_event_max_sample_rate_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos); -int perf_cpu_time_max_percent_handler (struct ctl_table *table,int write, +int perf_cpu_time_max_percent_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos); -int perf_event_max_stack_handler (struct ctl_table *table,int write, +int perf_event_max_stack_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);/* Access to perf_event_open(2) syscall. */
include/linux/security.h +1 -1
@@ -228,7 +228,7 @@ struct request_sock;#define LSM_UNSAFE_NO_NEW_PRIVS 4#ifdef CONFIG_MMU -extern int mmap_min_addr_handler (struct ctl_table *table,int write, +extern int mmap_min_addr_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);#endif
include/linux/sysctl.h +17 -17
@@ -61,31 +61,31 @@ extern const int sysctl_vals[];extern const unsigned long sysctl_long_vals[]; -typedef int proc_handler (struct ctl_table *ctl,int write,void *buffer, +typedef int proc_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -int proc_dostring (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_dobool (struct ctl_table *table,int write,void *buffer, +int proc_dostring (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_dobool (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos); -int proc_dointvec (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_douintvec (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_dointvec_minmax (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_douintvec_minmax (struct ctl_table *table,int write,void *buffer, +int proc_dointvec (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_douintvec (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_dointvec_minmax (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_douintvec_minmax (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos); -int proc_dou8vec_minmax (struct ctl_table *table,int write,void *buffer, +int proc_dou8vec_minmax (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos); -int proc_dointvec_jiffies (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_dointvec_ms_jiffies_minmax (struct ctl_table *table,int write, +int proc_dointvec_jiffies (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_dointvec_ms_jiffies_minmax (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos); -int proc_dointvec_userhz_jiffies (struct ctl_table *,int ,void *,size_t *, +int proc_dointvec_userhz_jiffies (const struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_dointvec_ms_jiffies (struct ctl_table *,int ,void *,size_t *, +int proc_dointvec_ms_jiffies (const struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_doulongvec_minmax (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_doulongvec_ms_jiffies_minmax (struct ctl_table *table,int ,void *, +int proc_doulongvec_minmax (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_doulongvec_ms_jiffies_minmax (const struct ctl_table *table,int ,void *,size_t *,loff_t *); -int proc_do_large_bitmap (struct ctl_table *,int ,void *,size_t *,loff_t *); -int proc_do_static_key (struct ctl_table *table,int write,void *buffer, +int proc_do_large_bitmap (const struct ctl_table *,int ,void *,size_t *,loff_t *); +int proc_do_static_key (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);/*
@@ -287,7 +287,7 @@ static inline bool sysctl_is_alias(char *param) }#endif /* CONFIG_SYSCTL */ -int sysctl_max_threads (struct ctl_table *table,int write,void *buffer, +int sysctl_max_threads (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);#endif /* _LINUX_SYSCTL_H */
include/linux/vmstat.h +3 -3
@@ -17,7 +17,7 @@ extern int sysctl_stat_interval;#define DISABLE_NUMA_STAT 0extern int sysctl_vm_numa_stat;DECLARE_STATIC_KEY_TRUE (vm_numa_stat_key); -int sysctl_vm_numa_stat_handler (struct ctl_table *table,int write, +int sysctl_vm_numa_stat_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos);#endif
@@ -285,8 +285,8 @@ void cpu_vm_stats_fold(int cpu);void refresh_zone_stat_thresholds (void );struct ctl_table ; -int vmstat_refresh (struct ctl_table *,int write,void *buffer,size_t *lenp, -loff_t *ppos); +int vmstat_refresh (const struct ctl_table *,int write,void *buffer, +size_t *lenp,loff_t *ppos);void drain_zonestat (struct zone *zone,struct per_cpu_zonestat *);
include/linux/writeback.h +1 -1
@@ -350,7 +350,7 @@ extern unsigned int dirty_expire_interval;extern unsigned int dirtytime_expire_interval;extern int laptop_mode; -int dirtytime_interval_handler (struct ctl_table *table,int write, +int dirtytime_interval_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);void global_dirty_limits (unsigned long *pbackground,unsigned long *pdirty);
include/net/ndisc.h +1 -1
@@ -486,7 +486,7 @@ void igmp6_event_report(struct sk_buff *skb);#ifdef CONFIG_SYSCTL -int ndisc_ifinfo_sysctl_change (struct ctl_table *ctl,int write, +int ndisc_ifinfo_sysctl_change (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos);#endif
include/net/neighbour.h +3 -3
@@ -412,12 +412,12 @@ void *neigh_seq_start(struct seq_file *, loff_t *, struct neigh_table *,void *neigh_seq_next (struct seq_file *,void *,loff_t *);void neigh_seq_stop (struct seq_file *,void *); -int neigh_proc_dointvec (struct ctl_table *ctl,int write, +int neigh_proc_dointvec (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -int neigh_proc_dointvec_jiffies (struct ctl_table *ctl,int write, +int neigh_proc_dointvec_jiffies (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -int neigh_proc_dointvec_ms_jiffies (struct ctl_table *ctl,int write, +int neigh_proc_dointvec_ms_jiffies (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); int neigh_sysctl_register(struct net_device *dev, struct neigh_parms *p,
include/net/netfilter/nf_hooks_lwtunnel.h +1 -1
@@ -2,6 +2,6 @@#include <linux/types.h> #ifdef CONFIG_SYSCTL -int nf_hooks_lwtunnel_sysctl_handler (struct ctl_table *table,int write, +int nf_hooks_lwtunnel_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);#endif
ipc/ipc_sysctl.c +4 -4
@@ -17,8 +17,8 @@#include <linux/cred.h> #include "util.h" -static int proc_ipc_dointvec_minmax_orphans (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int proc_ipc_dointvec_minmax_orphans (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ipc_namespace *ns = container_of(table->data, struct ipc_namespace, shm_rmid_forced);
@@ -33,7 +33,7 @@ static int proc_ipc_dointvec_minmax_orphans(struct ctl_table *table, int write,return err; } -static int proc_ipc_auto_msgmni (struct ctl_table *table,int write, +static int proc_ipc_auto_msgmni (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table ipc_table;
@@ -48,7 +48,7 @@ static int proc_ipc_auto_msgmni(struct ctl_table *table, int write,return proc_dointvec_minmax (&ipc_table, write, buffer, lenp, ppos); } -static int proc_ipc_sem_dointvec (struct ctl_table *table,int write, +static int proc_ipc_sem_dointvec (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { struct ipc_namespace *ns =
kernel/bpf/syscall.c +2 -2
@@ -5983,7 +5983,7 @@ const struct bpf_prog_ops bpf_syscall_prog_ops = { };#ifdef CONFIG_SYSCTL -static int bpf_stats_handler (struct ctl_table *table,int write, +static int bpf_stats_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct static_key *key = (struct static_key *)table->data;
@@ -6018,7 +6018,7 @@ void __weak unpriv_ebpf_notify(int new_state) { } -static int bpf_unpriv_handler (struct ctl_table *table,int write, +static int bpf_unpriv_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret, unpriv_enable = *(int *)table->data;
kernel/delayacct.c +2 -2
@@ -44,8 +44,8 @@ void delayacct_init(void) }#ifdef CONFIG_PROC_SYSCTL -static int sysctl_delayacct (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int sysctl_delayacct (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int state = delayacct_on;struct ctl_table t;
kernel/events/callchain.c +1 -1
@@ -229,7 +229,7 @@ get_perf_callchain(struct pt_regs *regs, u32 init_nr, bool kernel, bool user,* Used for sysctl_perf_event_max_stack and * sysctl_perf_event_max_contexts_per_stack. */ -int perf_event_max_stack_handler (struct ctl_table *table,int write, +int perf_event_max_stack_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *value = table->data;
kernel/events/core.c +2 -2
@@ -450,7 +450,7 @@ static void update_perf_cpu_limits(void)static bool perf_rotate_context (struct perf_cpu_pmu_context *cpc); -int perf_event_max_sample_rate_handler (struct ctl_table *table,int write, +int perf_event_max_sample_rate_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
@@ -474,7 +474,7 @@ int perf_event_max_sample_rate_handler(struct ctl_table *table, int write,int sysctl_perf_cpu_time_max_percent__read_mostly =DEFAULT_CPU_TIME_MAX_PERCENT ; -int perf_cpu_time_max_percent_handler (struct ctl_table *table,int write, +int perf_cpu_time_max_percent_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret =proc_dointvec_minmax (table, write, buffer, lenp, ppos);
kernel/fork.c +1 -1
@@ -3402,7 +3402,7 @@ int unshare_files(void)return 0 ; } -int sysctl_max_threads (struct ctl_table *table,int write, +int sysctl_max_threads (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table t;
kernel/hung_task.c +3 -3
@@ -239,9 +239,9 @@ static long hung_timeout_jiffies(unsigned long last_checked,/* * Process updating of timeout sysctl */ -static int proc_dohung_task_timeout_secs (struct ctl_table *table,int write, -void *buffer, -size_t *lenp,loff_t *ppos) +static int proc_dohung_task_timeout_secs (const struct ctl_table *table, +int write,void *buffer, +size_t *lenp,loff_t *ppos) {int ret;
kernel/kexec_core.c +1 -1
@@ -888,7 +888,7 @@ struct kimage *kexec_crash_image;static int kexec_load_disabled;#ifdef CONFIG_SYSCTL -static int kexec_limit_handler (struct ctl_table *table,int write, +static int kexec_limit_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct kexec_load_limit *limit = table->data;
kernel/kprobes.c +1 -1
@@ -939,7 +939,7 @@ static void unoptimize_all_kprobes(void)static DEFINE_MUTEX (kprobe_sysctl_mutex);static int sysctl_kprobes_optimization; -static int proc_kprobes_optimization_handler (struct ctl_table *table, +static int proc_kprobes_optimization_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {
kernel/latencytop.c +2 -2
@@ -65,8 +65,8 @@ static struct latency_record latency_record[MAXLR];int latencytop_enabled;#ifdef CONFIG_SYSCTL -static int sysctl_latencytop (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int sysctl_latencytop (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int err;
kernel/pid_namespace.c +1 -1
@@ -254,7 +254,7 @@ void zap_pid_ns_processes(struct pid_namespace *pid_ns) }#ifdef CONFIG_CHECKPOINT_RESTORE -static int pid_ns_ctl_handler (struct ctl_table *table,int write, +static int pid_ns_ctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct pid_namespace *pid_ns =task_active_pid_ns (current);
kernel/pid_sysctl.h +1 -1
@@ -5,7 +5,7 @@#include <linux/pid_namespace.h> #if defined(CONFIG_SYSCTL ) && defined(CONFIG_MEMFD_CREATE ) -static int pid_mfd_noexec_dointvec_minmax (struct ctl_table *table, +static int pid_mfd_noexec_dointvec_minmax (const struct ctl_table *table,int write,void *buf,size_t *lenp,loff_t *ppos) {struct pid_namespace *ns =task_active_pid_ns (current);
kernel/printk/internal.h +1 -1
@@ -9,7 +9,7 @@#if defined(CONFIG_PRINTK ) && defined(CONFIG_SYSCTL )struct ctl_table ;void __init printk_sysctl_init (void ); -int devkmsg_sysctl_set_loglvl (struct ctl_table *table,int write, +int devkmsg_sysctl_set_loglvl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos);#else #define printk_sysctl_init () do { } while (0)
kernel/printk/printk.c +1 -1
@@ -197,7 +197,7 @@ __setup("printk.devkmsg=", control_devkmsg);char devkmsg_log_str[DEVKMSG_STR_MAX_SIZE ] ="ratelimit" ;#if defined(CONFIG_PRINTK ) && defined(CONFIG_SYSCTL ) -int devkmsg_sysctl_set_loglvl (struct ctl_table *table,int write, +int devkmsg_sysctl_set_loglvl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {char old_str[DEVKMSG_STR_MAX_SIZE ];
kernel/printk/sysctl.c +3 -2
@@ -11,8 +11,9 @@static const int ten_thousand =10000 ; -static int proc_dointvec_minmax_sysadmin (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int proc_dointvec_minmax_sysadmin (const struct ctl_table *table, +int write,void *buffer, +size_t *lenp,loff_t *ppos) {if (write && !capable (CAP_SYS_ADMIN ))return -EPERM ;
kernel/sched/core.c +4 -4
@@ -1810,7 +1810,7 @@ static void uclamp_sync_util_min_rt_default(void)uclamp_update_util_min_rt_default (p); } -static int sysctl_sched_uclamp_handler (struct ctl_table *table,int write, +static int sysctl_sched_uclamp_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {bool update_root_tg = false;
@@ -4396,7 +4396,7 @@ static void reset_memory_tiering(void) } } -static int sysctl_numa_balancing (struct ctl_table *table,int write, +static int sysctl_numa_balancing (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table t;
@@ -4465,8 +4465,8 @@ static int __init setup_schedstats(char *str)__setup ("schedstats=" , setup_schedstats);#ifdef CONFIG_PROC_SYSCTL -static int sysctl_schedstats (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int sysctl_schedstats (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table t;int err;
kernel/sched/rt.c +8 -8
@@ -26,10 +26,10 @@ int sysctl_sched_rt_runtime = 950000; #ifdef CONFIG_SYSCTL static int sysctl_sched_rr_timeslice = (MSEC_PER_SEC * RR_TIMESLICE) / HZ; -static int sched_rt_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos); -static int sched_rr_handler(struct ctl_table *table, int write, void *buffer, - size_t *lenp, loff_t *ppos); +static int sched_rt_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos); +static int sched_rr_handler(const struct ctl_table *table, int write, + void *buffer, size_t *lenp, loff_t *ppos); static struct ctl_table sched_rt_sysctls[] = { { .procname = "sched_rt_period_us",
@@ -2952,8 +2952,8 @@ static void sched_rt_do_global(void)raw_spin_unlock_irqrestore (&def_rt_bandwidth.rt_runtime_lock, flags); } -static int sched_rt_handler (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int sched_rt_handler (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int old_period, old_runtime;static DEFINE_MUTEX (mutex);
@@ -2991,8 +2991,8 @@ static int sched_rt_handler(struct ctl_table *table, int write, void *buffer,return ret; } -static int sched_rr_handler (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int sched_rr_handler (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int ret;static DEFINE_MUTEX (mutex);
kernel/sched/topology.c +1 -1
@@ -285,7 +285,7 @@ void rebuild_sched_domains_energy(void) }#ifdef CONFIG_PROC_SYSCTL -static int sched_energy_aware_handler (struct ctl_table *table,int write, +static int sched_energy_aware_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret, state;
kernel/seccomp.c +3 -3
@@ -2413,9 +2413,9 @@ static void audit_actions_logged(u32 actions_logged, u32 old_actions_logged,return audit_seccomp_actions_logged (new, old, !ret); } -static int seccomp_actions_logged_handler (struct ctl_table *ro_table,int write, -void *buffer,size_t *lenp, -loff_t *ppos) +static int seccomp_actions_logged_handler (const struct ctl_table *ro_table, +int write,void *buffer, +size_t *lenp,loff_t *ppos) {int ret;
kernel/stackleak.c +1 -1
@@ -21,7 +21,7 @@static DEFINE_STATIC_KEY_FALSE (stack_erasing_bypass);#ifdef CONFIG_SYSCTL -static int stack_erasing_sysctl (struct ctl_table *table,int write, +static int stack_erasing_sysctl (const struct ctl_table *table,int write,void __user *buffer,size_t *lenp,loff_t *ppos) {int ret =0 ;
kernel/sysctl.c +34 -34
246 lines not on this page · raw message
kernel/time/timer.c +1 -1
@@ -289,7 +289,7 @@ static void timers_update_migration(void) }#ifdef CONFIG_SYSCTL -static int timer_migration_handler (struct ctl_table *table,int write, +static int timer_migration_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
kernel/trace/ftrace.c +1 -1
@@ -8738,7 +8738,7 @@ static bool is_permanent_ops_registered(void) }static int -ftrace_enable_sysctl (struct ctl_table *table,int write, +ftrace_enable_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret = -ENODEV ;
kernel/trace/trace.c +1 -1
@@ -2767,7 +2767,7 @@ static void output_printk(struct trace_event_buffer *fbuffer)raw_spin_unlock_irqrestore (&tracepoint_iter_lock, flags); } -int tracepoint_printk_sysctl (struct ctl_table *table,int write, +int tracepoint_printk_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
kernel/trace/trace_events_user.c +1 -1
@@ -2885,7 +2885,7 @@ static int create_user_tracefs(void)return -ENODEV ; } -static int set_max_user_events_sysctl (struct ctl_table *table,int write, +static int set_max_user_events_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
kernel/trace/trace_stack.c +1 -1
@@ -514,7 +514,7 @@ static const struct file_operations stack_trace_filter_fops = {#endif /* CONFIG_DYNAMIC_FTRACE */ int -stack_trace_sysctl (struct ctl_table *table,int write,void *buffer, +stack_trace_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int was_enabled;
kernel/umh.c +1 -1
@@ -495,7 +495,7 @@ int call_usermodehelper(const char *path, char **argv, char **envp, int wait)EXPORT_SYMBOL (call_usermodehelper);#if defined(CONFIG_SYSCTL ) -static int proc_cap_handler (struct ctl_table *table,int write, +static int proc_cap_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table t;
kernel/utsname_sysctl.c +1 -1
@@ -30,7 +30,7 @@ static void *get_uts(const struct ctl_table *table)* Special case of dostring for the UTS structure. This has locks * to observe. Should this be in kernel/sys.c ???? */ -static int proc_do_uts_string (struct ctl_table *table,int write, +static int proc_do_uts_string (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table uts_table;
kernel/watchdog.c +6 -6
@@ -983,7 +983,7 @@ static void proc_watchdog_update(void)* -------------------|----------------------------------|------------------------------- * proc_soft_watchdog | watchdog_softlockup_user_enabled | WATCHDOG_SOFTOCKUP_ENABLED */ -static int proc_watchdog_common (int which,struct ctl_table *table,int write, +static int proc_watchdog_common (int which,const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int err, old, *param = table->data;
@@ -1010,7 +1010,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,/* * /proc/sys/kernel/watchdog */ -static int proc_watchdog (struct ctl_table *table,int write, +static int proc_watchdog (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { return proc_watchdog_common(WATCHDOG_HARDLOCKUP_ENABLED |
@@ -1021,7 +1021,7 @@ static int proc_watchdog(struct ctl_table *table, int write,/* * /proc/sys/kernel/nmi_watchdog */ -static int proc_nmi_watchdog (struct ctl_table *table,int write, +static int proc_nmi_watchdog (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {if (!watchdog_hardlockup_available && write)
@@ -1034,7 +1034,7 @@ static int proc_nmi_watchdog(struct ctl_table *table, int write,/* * /proc/sys/kernel/soft_watchdog */ -static int proc_soft_watchdog (struct ctl_table *table,int write, +static int proc_soft_watchdog (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { return proc_watchdog_common(WATCHDOG_SOFTOCKUP_ENABLED,
@@ -1045,7 +1045,7 @@ static int proc_soft_watchdog(struct ctl_table *table, int write,/* * /proc/sys/kernel/watchdog_thresh */ -static int proc_watchdog_thresh (struct ctl_table *table,int write, +static int proc_watchdog_thresh (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int err, old;
@@ -1068,7 +1068,7 @@ static int proc_watchdog_thresh(struct ctl_table *table, int write,* user to specify a mask that will include cpus that have not yet * been brought online, if desired. */ -static int proc_watchdog_cpumask (struct ctl_table *table,int write, +static int proc_watchdog_cpumask (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int err;
mm/compaction.c +3 -3
@@ -2962,7 +2962,7 @@ static int compact_nodes(void)return 0 ; } -static int compaction_proactiveness_sysctl_handler (struct ctl_table *table,int write, +static int compaction_proactiveness_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int rc, nid;
@@ -2992,7 +2992,7 @@ static int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int* This is the entry point for compacting all nodes via * /proc/sys/vm/compact_memory */ -static int sysctl_compaction_handler (struct ctl_table *table,int write, +static int sysctl_compaction_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int ret;
@@ -3303,7 +3303,7 @@ static int kcompactd_cpu_online(unsigned int cpu)return 0 ; } -static int proc_dointvec_minmax_warn_RT_change (struct ctl_table *table, +static int proc_dointvec_minmax_warn_RT_change (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret, old;
mm/hugetlb.c +4 -4
@@ -4952,7 +4952,7 @@ static int hugetlb_sysctl_handler_common(bool obey_mempolicy,return ret; } -static int hugetlb_sysctl_handler (struct ctl_table *table,int write, +static int hugetlb_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {
@@ -4961,15 +4961,15 @@ static int hugetlb_sysctl_handler(struct ctl_table *table, int write, }#ifdef CONFIG_NUMA -static int hugetlb_mempolicy_sysctl_handler (struct ctl_table *table,int write, -void *buffer,size_t *length,loff_t *ppos) +static int hugetlb_mempolicy_sysctl_handler (const struct ctl_table *table, +int write,void *buffer,size_t *length,loff_t *ppos) {return hugetlb_sysctl_handler_common (true, table, write, buffer, length, ppos); }#endif /* CONFIG_NUMA */ -static int hugetlb_overcommit_handler (struct ctl_table *table,int write, +static int hugetlb_overcommit_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {struct hstate *h = &default_hstate;
mm/page-writeback.c +9 -9
@@ -495,8 +495,8 @@ bool node_dirty_ok(struct pglist_data *pgdat) }#ifdef CONFIG_SYSCTL -static int dirty_background_ratio_handler (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int dirty_background_ratio_handler (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
@@ -506,8 +506,8 @@ static int dirty_background_ratio_handler(struct ctl_table *table, int write,return ret; } -static int dirty_background_bytes_handler (struct ctl_table *table,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int dirty_background_bytes_handler (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
@@ -517,8 +517,8 @@ static int dirty_background_bytes_handler(struct ctl_table *table, int write,return ret; } -static int dirty_ratio_handler (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +static int dirty_ratio_handler (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int old_ratio = vm_dirty_ratio;int ret;
@@ -531,7 +531,7 @@ static int dirty_ratio_handler(struct ctl_table *table, int write, void *buffer,return ret; } -static int dirty_bytes_handler (struct ctl_table *table,int write, +static int dirty_bytes_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {unsigned long old_bytes = vm_dirty_bytes;
@@ -2181,8 +2181,8 @@ bool wb_over_bg_thresh(struct bdi_writeback *wb)/* * sysctl handler for /proc/sys/vm/dirty_writeback_centisecs */ -static int dirty_writeback_centisecs_handler (struct ctl_table *table,int write, -void *buffer,size_t *length,loff_t *ppos) +static int dirty_writeback_centisecs_handler (const struct ctl_table *table, +int write,void *buffer,size_t *length,loff_t *ppos) {unsigned int old_interval = dirty_writeback_interval;int ret;
mm/page_alloc.c +7 -7
@@ -5171,7 +5171,7 @@ static char numa_zonelist_order[] = "Node";/* * sysctl handler for numa_zonelist_order */ -static int numa_zonelist_order_handler (struct ctl_table *table,int write, +static int numa_zonelist_order_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {if (write)
@@ -6135,7 +6135,7 @@ postcore_initcall(init_per_zone_wmark_min)* that we can call two helper functions whenever min_free_kbytes * changes. */ -static int min_free_kbytes_sysctl_handler (struct ctl_table *table,int write, +static int min_free_kbytes_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int rc;
@@ -6151,7 +6151,7 @@ static int min_free_kbytes_sysctl_handler(struct ctl_table *table, int write,return 0 ; } -static int watermark_scale_factor_sysctl_handler (struct ctl_table *table,int write, +static int watermark_scale_factor_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int rc;
@@ -6181,7 +6181,7 @@ static void setup_min_unmapped_ratio(void) } -static int sysctl_min_unmapped_ratio_sysctl_handler (struct ctl_table *table,int write, +static int sysctl_min_unmapped_ratio_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int rc;
@@ -6208,7 +6208,7 @@ static void setup_min_slab_ratio(void) sysctl_min_slab_ratio) / 100; } -static int sysctl_min_slab_ratio_sysctl_handler (struct ctl_table *table,int write, +static int sysctl_min_slab_ratio_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int rc;
@@ -6232,7 +6232,7 @@ static int sysctl_min_slab_ratio_sysctl_handler(struct ctl_table *table, int wri* minimum watermarks. The lowmem reserve ratio can only make sense * if in function of the boot time zone sizes. */ -static int lowmem_reserve_ratio_sysctl_handler (struct ctl_table *table, +static int lowmem_reserve_ratio_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int i;
@@ -6253,7 +6253,7 @@ static int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *table,* cpu. It is the fraction of total pages in each zone that a hot per cpu * pagelist can have before it gets flushed back to buddy allocator. */ -static int percpu_pagelist_high_fraction_sysctl_handler (struct ctl_table *table, +static int percpu_pagelist_high_fraction_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {struct zone *zone;
mm/util.c +6 -6
@@ -855,8 +855,8 @@ int sysctl_max_map_count __read_mostly = DEFAULT_MAX_MAP_COUNT;unsigned long sysctl_user_reserve_kbytes__read_mostly =1UL <<17 ;/* 128MB */ unsigned long sysctl_admin_reserve_kbytes__read_mostly =1UL <<13 ;/* 8MB */ -int overcommit_ratio_handler (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +int overcommit_ratio_handler (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int ret;
@@ -871,8 +871,8 @@ static void sync_overcommit_as(struct work_struct *dummy)percpu_counter_sync (&vm_committed_as); } -int overcommit_policy_handler (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +int overcommit_policy_handler (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table t;int new_policy =-1 ;
@@ -907,8 +907,8 @@ int overcommit_policy_handler(struct ctl_table *table, int write, void *buffer,return ret; } -int overcommit_kbytes_handler (struct ctl_table *table,int write,void *buffer, -size_t *lenp,loff_t *ppos) +int overcommit_kbytes_handler (const struct ctl_table *table,int write, +void *buffer,size_t *lenp,loff_t *ppos) {int ret;
mm/vmstat.c +2 -2
@@ -74,7 +74,7 @@ static void invalid_numa_statistics(void)static DEFINE_MUTEX (vm_numa_stat_lock); -int sysctl_vm_numa_stat_handler (struct ctl_table *table,int write, +int sysctl_vm_numa_stat_handler (const struct ctl_table *table,int write,void *buffer,size_t *length,loff_t *ppos) {int ret, oldval;
@@ -1912,7 +1912,7 @@ static void refresh_vm_stats(struct work_struct *work)refresh_cpu_vm_stats (true); } -int vmstat_refresh (struct ctl_table *table,int write, +int vmstat_refresh (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {long val;
net/bridge/br_netfilter_hooks.c +1 -1
@@ -1177,7 +1177,7 @@ int br_nf_hook_thresh(unsigned int hook, struct net *net,#ifdef CONFIG_SYSCTL static -int brnf_sysctl_call_tables (struct ctl_table *ctl,int write, +int brnf_sysctl_call_tables (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
net/core/neighbour.c +9 -9
@@ -3543,7 +3543,7 @@ EXPORT_SYMBOL(neigh_app_ns);#ifdef CONFIG_SYSCTL static int unres_qlen_max =INT_MAX /SKB_TRUESIZE (ETH_FRAME_LEN ); -static int proc_unres_qlen (struct ctl_table *ctl,int write, +static int proc_unres_qlen (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int size, ret;
@@ -3595,7 +3595,7 @@ static void neigh_proc_update(const struct ctl_table *ctl, int write)neigh_copy_dflt_parms (net, p, index); } -static int neigh_proc_dointvec_zero_intmax (struct ctl_table *ctl,int write, +static int neigh_proc_dointvec_zero_intmax (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -3610,7 +3610,7 @@ static int neigh_proc_dointvec_zero_intmax(struct ctl_table *ctl, int write,return ret; } -static int neigh_proc_dointvec_ms_jiffies_positive (struct ctl_table *ctl,int write, +static int neigh_proc_dointvec_ms_jiffies_positive (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table tmp = *ctl;
@@ -3626,7 +3626,7 @@ static int neigh_proc_dointvec_ms_jiffies_positive(struct ctl_table *ctl, int wrreturn ret; } -int neigh_proc_dointvec (struct ctl_table *ctl,int write,void *buffer, +int neigh_proc_dointvec (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret =proc_dointvec (ctl, write, buffer, lenp, ppos);
@@ -3636,7 +3636,7 @@ int neigh_proc_dointvec(struct ctl_table *ctl, int write, void *buffer, }EXPORT_SYMBOL (neigh_proc_dointvec); -int neigh_proc_dointvec_jiffies (struct ctl_table *ctl,int write,void *buffer, +int neigh_proc_dointvec_jiffies (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret =proc_dointvec_jiffies (ctl, write, buffer, lenp, ppos);
@@ -3646,7 +3646,7 @@ int neigh_proc_dointvec_jiffies(struct ctl_table *ctl, int write, void *buffer, }EXPORT_SYMBOL (neigh_proc_dointvec_jiffies); -static int neigh_proc_dointvec_userhz_jiffies (struct ctl_table *ctl,int write, +static int neigh_proc_dointvec_userhz_jiffies (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -3656,7 +3656,7 @@ static int neigh_proc_dointvec_userhz_jiffies(struct ctl_table *ctl, int write,return ret; } -int neigh_proc_dointvec_ms_jiffies (struct ctl_table *ctl,int write, +int neigh_proc_dointvec_ms_jiffies (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret =proc_dointvec_ms_jiffies (ctl, write, buffer, lenp, ppos);
@@ -3666,7 +3666,7 @@ int neigh_proc_dointvec_ms_jiffies(struct ctl_table *ctl, int write, }EXPORT_SYMBOL (neigh_proc_dointvec_ms_jiffies); -static int neigh_proc_dointvec_unres_qlen (struct ctl_table *ctl,int write, +static int neigh_proc_dointvec_unres_qlen (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -3676,7 +3676,7 @@ static int neigh_proc_dointvec_unres_qlen(struct ctl_table *ctl, int write,return ret; } -static int neigh_proc_base_reachable_time (struct ctl_table *ctl,int write, +static int neigh_proc_base_reachable_time (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
net/core/sysctl_net_core.c +10 -10
@@ -95,7 +95,7 @@ static struct cpumask *rps_default_mask_cow_alloc(struct net *net)return rps_default_mask; } -static int rps_default_mask_sysctl (struct ctl_table *table,int write, +static int rps_default_mask_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = (struct net *)table->data;
@@ -126,7 +126,7 @@ static int rps_default_mask_sysctl(struct ctl_table *table, int write,return err; } -static int rps_sock_flow_sysctl (struct ctl_table *table,int write, +static int rps_sock_flow_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {unsigned int orig_size, size;
@@ -198,7 +198,7 @@ static int rps_sock_flow_sysctl(struct ctl_table *table, int write,#ifdef CONFIG_NET_FLOW_LIMIT static DEFINE_MUTEX (flow_limit_update_mutex); -static int flow_limit_cpu_sysctl (struct ctl_table *table,int write, +static int flow_limit_cpu_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct sd_flow_limit *cur;
@@ -255,7 +255,7 @@ static int flow_limit_cpu_sysctl(struct ctl_table *table, int write,return ret; } -static int flow_limit_table_len_sysctl (struct ctl_table *table,int write, +static int flow_limit_table_len_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {unsigned int old, *ptr;
@@ -277,7 +277,7 @@ static int flow_limit_table_len_sysctl(struct ctl_table *table, int write,#endif /* CONFIG_NET_FLOW_LIMIT */ #ifdef CONFIG_NET_SCHED -static int set_default_qdisc (struct ctl_table *table,int write, +static int set_default_qdisc (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {char id[IFNAMSIZ ];
@@ -296,7 +296,7 @@ static int set_default_qdisc(struct ctl_table *table, int write, }#endif -static int proc_do_dev_weight (struct ctl_table *table,int write, +static int proc_do_dev_weight (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {static DEFINE_MUTEX (dev_weight_mutex);
@@ -314,7 +314,7 @@ static int proc_do_dev_weight(struct ctl_table *table, int write,return ret; } -static int proc_do_rss_key (struct ctl_table *table,int write, +static int proc_do_rss_key (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table fake_table;
@@ -327,7 +327,7 @@ static int proc_do_rss_key(struct ctl_table *table, int write, }#ifdef CONFIG_BPF_JIT -static int proc_dointvec_minmax_bpf_enable (struct ctl_table *table,int write, +static int proc_dointvec_minmax_bpf_enable (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -360,7 +360,7 @@ static int proc_dointvec_minmax_bpf_enable(struct ctl_table *table, int write,# ifdef CONFIG_HAVE_EBPF_JIT static int -proc_dointvec_minmax_bpf_restricted (struct ctl_table *table,int write, +proc_dointvec_minmax_bpf_restricted (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {if (!capable (CAP_SYS_ADMIN ))
@@ -371,7 +371,7 @@ proc_dointvec_minmax_bpf_restricted(struct ctl_table *table, int write,# endif /* CONFIG_HAVE_EBPF_JIT */ static int -proc_dolongvec_minmax_bpf_restricted (struct ctl_table *table,int write, +proc_dolongvec_minmax_bpf_restricted (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {if (!capable (CAP_SYS_ADMIN ))
net/ipv4/devinet.c +3 -3
@@ -2390,7 +2390,7 @@ static int devinet_conf_ifindex(struct net *net, struct ipv4_devconf *cnf) } } -static int devinet_conf_proc (struct ctl_table *ctl,int write, +static int devinet_conf_proc (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int old_value = *(int *)ctl->data;
@@ -2442,7 +2442,7 @@ static int devinet_conf_proc(struct ctl_table *ctl, int write,return ret; } -static int devinet_sysctl_forward (struct ctl_table *ctl,int write, +static int devinet_sysctl_forward (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = ctl->data;
@@ -2489,7 +2489,7 @@ static int devinet_sysctl_forward(struct ctl_table *ctl, int write,return ret; } -static int ipv4_doint_and_flush (struct ctl_table *ctl,int write, +static int ipv4_doint_and_flush (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = ctl->data;
net/ipv4/route.c +1 -1
@@ -3388,7 +3388,7 @@ static int ip_rt_gc_min_interval __read_mostly = HZ / 2;static int ip_rt_gc_elasticity__read_mostly =8 ;static int ip_min_valid_pmtu__read_mostly =IPV4_MIN_MTU ; -static int ipv4_sysctl_rtcache_flush (struct ctl_table *__ctl,int write, +static int ipv4_sysctl_rtcache_flush (const struct ctl_table *__ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = (struct net *)__ctl->extra1;
net/ipv4/sysctl_net_ipv4.c +17 -17
@@ -62,7 +62,7 @@ static void set_local_port_range(struct net *net, unsigned int low, unsigned int }/* Validate changes from /proc interface. */ -static int ipv4_local_port_range (struct ctl_table *table,int write, +static int ipv4_local_port_range (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = table->data;
@@ -96,7 +96,7 @@ static int ipv4_local_port_range(struct ctl_table *table, int write, }/* Validate changes from /proc interface. */ -static int ipv4_privileged_ports (struct ctl_table *table,int write, +static int ipv4_privileged_ports (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(table->data, struct net,
@@ -159,7 +159,7 @@ static void set_ping_group_range(const struct ctl_table *table, }/* Validate changes from /proc interface. */ -static int ipv4_ping_group_range (struct ctl_table *table,int write, +static int ipv4_ping_group_range (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct user_namespace *user_ns =current_user_ns ();
@@ -194,7 +194,7 @@ static int ipv4_ping_group_range(struct ctl_table *table, int write,return ret; } -static int ipv4_fwd_update_priority (struct ctl_table *table,int write, +static int ipv4_fwd_update_priority (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;
@@ -210,7 +210,7 @@ static int ipv4_fwd_update_priority(struct ctl_table *table, int write,return ret; } -static int proc_tcp_congestion_control (struct ctl_table *ctl,int write, +static int proc_tcp_congestion_control (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(ctl->data, struct net,
@@ -230,7 +230,7 @@ static int proc_tcp_congestion_control(struct ctl_table *ctl, int write,return ret; } -static int proc_tcp_available_congestion_control (struct ctl_table *ctl, +static int proc_tcp_available_congestion_control (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -246,7 +246,7 @@ static int proc_tcp_available_congestion_control(struct ctl_table *ctl,return ret; } -static int proc_allowed_congestion_control (struct ctl_table *ctl, +static int proc_allowed_congestion_control (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -283,7 +283,7 @@ static int sscanf_key(char *buf, __le32 *key)return ret; } -static int proc_tcp_fastopen_key (struct ctl_table *table,int write, +static int proc_tcp_fastopen_key (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(table->data, struct net,
@@ -354,7 +354,7 @@ static int proc_tcp_fastopen_key(struct ctl_table *table, int write,return ret; } -static int proc_tfo_blackhole_detect_timeout (struct ctl_table *table, +static int proc_tfo_blackhole_detect_timeout (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -369,7 +369,7 @@ static int proc_tfo_blackhole_detect_timeout(struct ctl_table *table,return ret; } -static int proc_tcp_available_ulp (struct ctl_table *ctl, +static int proc_tcp_available_ulp (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -386,7 +386,7 @@ static int proc_tcp_available_ulp(struct ctl_table *ctl,return ret; } -static int proc_tcp_ehash_entries (struct ctl_table *table,int write, +static int proc_tcp_ehash_entries (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(table->data, struct net,
@@ -410,7 +410,7 @@ static int proc_tcp_ehash_entries(struct ctl_table *table, int write,return proc_dointvec (&tbl, write, buffer, lenp, ppos); } -static int proc_udp_hash_entries (struct ctl_table *table,int write, +static int proc_udp_hash_entries (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(table->data, struct net,
@@ -434,8 +434,8 @@ static int proc_udp_hash_entries(struct ctl_table *table, int write, }#ifdef CONFIG_IP_ROUTE_MULTIPATH -static int proc_fib_multipath_hash_policy (struct ctl_table *table,int write, -void *buffer,size_t *lenp, +static int proc_fib_multipath_hash_policy (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) { struct net *net = container_of(table->data, struct net,
@@ -449,8 +449,8 @@ static int proc_fib_multipath_hash_policy(struct ctl_table *table, int write,return ret; } -static int proc_fib_multipath_hash_fields (struct ctl_table *table,int write, -void *buffer,size_t *lenp, +static int proc_fib_multipath_hash_fields (const struct ctl_table *table, +int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;
@@ -484,7 +484,7 @@ static void proc_fib_multipath_hash_set_seed(struct net *net, u32 user_seed)WRITE_ONCE (net->ipv4.sysctl_fib_multipath_hash_seed, new); } -static int proc_fib_multipath_hash_seed (struct ctl_table *table,int write, +static int proc_fib_multipath_hash_seed (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {
net/ipv6/addrconf.c +10 -9
@@ -6308,7 +6308,7 @@ static void ipv6_ifa_notify(int event, struct inet6_ifaddr *ifp)#ifdef CONFIG_SYSCTL -static int addrconf_sysctl_forward (struct ctl_table *ctl,int write, +static int addrconf_sysctl_forward (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = ctl->data;
@@ -6333,7 +6333,7 @@ static int addrconf_sysctl_forward(struct ctl_table *ctl, int write,return ret; } -static int addrconf_sysctl_mtu (struct ctl_table *ctl,int write, +static int addrconf_sysctl_mtu (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct inet6_dev *idev = ctl->extra1;
@@ -6404,7 +6404,7 @@ static int addrconf_disable_ipv6(const struct ctl_table *table, int *p, int newfreturn 0 ; } -static int addrconf_sysctl_disable (struct ctl_table *ctl,int write, +static int addrconf_sysctl_disable (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = ctl->data;
@@ -6429,7 +6429,7 @@ static int addrconf_sysctl_disable(struct ctl_table *ctl, int write,return ret; } -static int addrconf_sysctl_proxy_ndp (struct ctl_table *ctl,int write, +static int addrconf_sysctl_proxy_ndp (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = ctl->data;
@@ -6470,7 +6470,7 @@ static int addrconf_sysctl_proxy_ndp(struct ctl_table *ctl, int write,return ret; } -static int addrconf_sysctl_addr_gen_mode (struct ctl_table *ctl,int write, +static int addrconf_sysctl_addr_gen_mode (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -6533,7 +6533,7 @@ static int addrconf_sysctl_addr_gen_mode(struct ctl_table *ctl, int write,return ret; } -static int addrconf_sysctl_stable_secret (struct ctl_table *ctl,int write, +static int addrconf_sysctl_stable_secret (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
@@ -6601,7 +6601,7 @@ static int addrconf_sysctl_stable_secret(struct ctl_table *ctl, int write, }static -int addrconf_sysctl_ignore_routes_with_linkdown (struct ctl_table *ctl, +int addrconf_sysctl_ignore_routes_with_linkdown (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos)
@@ -6701,8 +6701,9 @@ int addrconf_disable_policy(const struct ctl_table *ctl, int *valp, int val)return 0 ; } -static int addrconf_sysctl_disable_policy (struct ctl_table *ctl,int write, -void *buffer,size_t *lenp,loff_t *ppos) +static int addrconf_sysctl_disable_policy (const struct ctl_table *ctl, +int write,void *buffer, +size_t *lenp,loff_t *ppos) {int *valp = ctl->data;int val = *valp;
net/ipv6/ndisc.c +1 -1
@@ -1951,7 +1951,7 @@ static void ndisc_warn_deprecated_sysctl(const struct ctl_table *ctl, } } -int ndisc_ifinfo_sysctl_change (struct ctl_table *ctl,int write,void *buffer, +int ndisc_ifinfo_sysctl_change (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net_device *dev = ctl->extra1;
net/ipv6/route.c +1 -1
@@ -6334,7 +6334,7 @@ static int rt6_stats_seq_show(struct seq_file *seq, void *v)#ifdef CONFIG_SYSCTL -static int ipv6_sysctl_rtcache_flush (struct ctl_table *ctl,int write, +static int ipv6_sysctl_rtcache_flush (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;
net/ipv6/sysctl_net_ipv6.c +2 -2
@@ -30,7 +30,7 @@ static u32 rt6_multipath_hash_fields_all_mask =static u32 ioam6_id_max =IOAM6_DEFAULT_ID ;static u64 ioam6_id_wide_max =IOAM6_DEFAULT_ID_WIDE ; -static int proc_rt6_multipath_hash_policy (struct ctl_table *table,int write, +static int proc_rt6_multipath_hash_policy (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;
@@ -46,7 +46,7 @@ static int proc_rt6_multipath_hash_policy(struct ctl_table *table, int write, }static int -proc_rt6_multipath_hash_fields (struct ctl_table *table,int write,void *buffer, +proc_rt6_multipath_hash_fields (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net;
net/mpls/af_mpls.c +2 -2
@@ -1347,7 +1347,7 @@ static int mpls_netconf_dump_devconf(struct sk_buff *skb,#define MPLS_PERDEV_SYSCTL_OFFSET (field) \ (&((struct mpls_dev *)0)->field) -static int mpls_conf_proc (struct ctl_table *ctl,int write, +static int mpls_conf_proc (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {int oval = *(int *)ctl->data;
@@ -2600,7 +2600,7 @@ static int resize_platform_label_table(struct net *net, size_t limit)return -ENOMEM ; } -static int mpls_platform_labels (struct ctl_table *table,int write, +static int mpls_platform_labels (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = table->data;
net/mptcp/ctrl.c +2 -2
@@ -113,7 +113,7 @@ static int mptcp_set_scheduler(const struct net *net, const char *name)return ret; } -static int proc_scheduler (struct ctl_table *ctl,int write, +static int proc_scheduler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {const struct net *net = current->nsproxy->net_ns;
@@ -133,7 +133,7 @@ static int proc_scheduler(struct ctl_table *ctl, int write,return ret; } -static int proc_available_schedulers (struct ctl_table *ctl, +static int proc_available_schedulers (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {
net/netfilter/ipvs/ip_vs_ctl.c +6 -6
@@ -1846,7 +1846,7 @@ static int ip_vs_zero_all(struct netns_ipvs *ipvs)#ifdef CONFIG_SYSCTL static int -proc_do_defense_mode (struct ctl_table *table,int write, +proc_do_defense_mode (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct netns_ipvs *ipvs = table->extra2;
@@ -1873,7 +1873,7 @@ proc_do_defense_mode(struct ctl_table *table, int write, }static int -proc_do_sync_threshold (struct ctl_table *table,int write, +proc_do_sync_threshold (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct netns_ipvs *ipvs = table->extra2;
@@ -1901,7 +1901,7 @@ proc_do_sync_threshold(struct ctl_table *table, int write, }static int -proc_do_sync_ports (struct ctl_table *table,int write, +proc_do_sync_ports (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int *valp = table->data;
@@ -1984,7 +1984,7 @@ static int ipvs_proc_est_cpumask_get(const struct ctl_table *table,return ret; } -static int ipvs_proc_est_cpulist (struct ctl_table *table,int write, +static int ipvs_proc_est_cpulist (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
@@ -2011,7 +2011,7 @@ static int ipvs_proc_est_cpulist(struct ctl_table *table, int write,return ret; } -static int ipvs_proc_est_nice (struct ctl_table *table,int write, +static int ipvs_proc_est_nice (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct netns_ipvs *ipvs = table->extra2;
@@ -2041,7 +2041,7 @@ static int ipvs_proc_est_nice(struct ctl_table *table, int write,return ret; } -static int ipvs_proc_run_estimation (struct ctl_table *table,int write, +static int ipvs_proc_run_estimation (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct netns_ipvs *ipvs = table->extra2;
net/netfilter/nf_conntrack_standalone.c +1 -1
@@ -527,7 +527,7 @@ EXPORT_SYMBOL_GPL(nf_conntrack_count);static unsigned int nf_conntrack_htable_size_user__read_mostly ;static int -nf_conntrack_hash_sysctl (struct ctl_table *table,int write, +nf_conntrack_hash_sysctl (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
net/netfilter/nf_hooks_lwtunnel.c +1 -1
@@ -25,7 +25,7 @@ static inline int nf_hooks_lwtunnel_set(int enable) }#ifdef CONFIG_SYSCTL -int nf_hooks_lwtunnel_sysctl_handler (struct ctl_table *table,int write, +int nf_hooks_lwtunnel_sysctl_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int proc_nf_hooks_lwtunnel_enabled =0 ;
net/netfilter/nf_log.c +1 -1
@@ -408,7 +408,7 @@ static struct ctl_table nf_log_sysctl_ftable[] = { }, }; -static int nf_log_proc_dostring (struct ctl_table *table,int write, +static int nf_log_proc_dostring (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {const struct nf_logger *logger;
net/phonet/sysctl.c +1 -1
@@ -48,7 +48,7 @@ void phonet_get_local_port_range(int *min, int *max) }while (read_seqretry (&local_port_range_lock, seq)); } -static int proc_local_port_range (struct ctl_table *table,int write, +static int proc_local_port_range (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
net/rds/tcp.c +2 -2
@@ -61,7 +61,7 @@ static atomic_t rds_tcp_unloading = ATOMIC_INIT(0);static struct kmem_cache *rds_tcp_conn_slab; -static int rds_tcp_skbuf_handler (struct ctl_table *ctl,int write, +static int rds_tcp_skbuf_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *fpos);static int rds_tcp_min_sndbuf =SOCK_MIN_SNDBUF ;
@@ -682,7 +682,7 @@ static void rds_tcp_sysctl_reset(struct net *net)spin_unlock_irq (&rds_tcp_conn_lock); } -static int rds_tcp_skbuf_handler (struct ctl_table *ctl,int write, +static int rds_tcp_skbuf_handler (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *fpos) {struct net *net = current->nsproxy->net_ns;
net/sctp/sysctl.c +16 -16
@@ -43,19 +43,19 @@ static unsigned long max_autoclose_max = (MAX_SCHEDULE_TIMEOUT /HZ >UINT_MAX ) ?UINT_MAX :MAX_SCHEDULE_TIMEOUT /HZ ; -static int proc_sctp_do_hmac_alg (struct ctl_table *ctl,int write, +static int proc_sctp_do_hmac_alg (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -static int proc_sctp_do_rto_min (struct ctl_table *ctl,int write, +static int proc_sctp_do_rto_min (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -static int proc_sctp_do_rto_max (struct ctl_table *ctl,int write,void *buffer, -size_t *lenp,loff_t *ppos); -static int proc_sctp_do_udp_port (struct ctl_table *ctl,int write,void *buffer, -size_t *lenp,loff_t *ppos); -static int proc_sctp_do_alpha_beta (struct ctl_table *ctl,int write, +static int proc_sctp_do_rto_max (const struct ctl_table *ctl,int write, +void *buffer,size_t *lenp,loff_t *ppos); +static int proc_sctp_do_udp_port (const struct ctl_table *ctl,int write, +void *buffer,size_t *lenp,loff_t *ppos); +static int proc_sctp_do_alpha_beta (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -static int proc_sctp_do_auth (struct ctl_table *ctl,int write, +static int proc_sctp_do_auth (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos); -static int proc_sctp_do_probe_interval (struct ctl_table *ctl,int write, +static int proc_sctp_do_probe_interval (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos);static struct ctl_table sctp_table[] = {
@@ -384,7 +384,7 @@ static struct ctl_table sctp_net_table[] = { }, }; -static int proc_sctp_do_hmac_alg (struct ctl_table *ctl,int write, +static int proc_sctp_do_hmac_alg (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = current->nsproxy->net_ns;
@@ -429,7 +429,7 @@ static int proc_sctp_do_hmac_alg(struct ctl_table *ctl, int write,return ret; } -static int proc_sctp_do_rto_min (struct ctl_table *ctl,int write, +static int proc_sctp_do_rto_min (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = current->nsproxy->net_ns;
@@ -457,7 +457,7 @@ static int proc_sctp_do_rto_min(struct ctl_table *ctl, int write,return ret; } -static int proc_sctp_do_rto_max (struct ctl_table *ctl,int write, +static int proc_sctp_do_rto_max (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = current->nsproxy->net_ns;
@@ -485,7 +485,7 @@ static int proc_sctp_do_rto_max(struct ctl_table *ctl, int write,return ret; } -static int proc_sctp_do_alpha_beta (struct ctl_table *ctl,int write, +static int proc_sctp_do_alpha_beta (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {if (write)
@@ -495,7 +495,7 @@ static int proc_sctp_do_alpha_beta(struct ctl_table *ctl, int write,return proc_dointvec_minmax (ctl, write, buffer, lenp, ppos); } -static int proc_sctp_do_auth (struct ctl_table *ctl,int write, +static int proc_sctp_do_auth (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = current->nsproxy->net_ns;
@@ -524,7 +524,7 @@ static int proc_sctp_do_auth(struct ctl_table *ctl, int write,return ret; } -static int proc_sctp_do_udp_port (struct ctl_table *ctl,int write, +static int proc_sctp_do_udp_port (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = current->nsproxy->net_ns;
@@ -565,7 +565,7 @@ static int proc_sctp_do_udp_port(struct ctl_table *ctl, int write,return ret; } -static int proc_sctp_do_probe_interval (struct ctl_table *ctl,int write, +static int proc_sctp_do_probe_interval (const struct ctl_table *ctl,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct net *net = current->nsproxy->net_ns;
net/sunrpc/sysctl.c +3 -3
@@ -40,7 +40,7 @@ EXPORT_SYMBOL_GPL(nlm_debug);#if IS_ENABLED (CONFIG_SUNRPC_DEBUG ) -static int proc_do_xprt (struct ctl_table *table,int write, +static int proc_do_xprt (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {char tmpbuf[256 ];
@@ -62,8 +62,8 @@ static int proc_do_xprt(struct ctl_table *table, int write, }static int -proc_dodebug (struct ctl_table *table,int write,void *buffer,size_t *lenp, -loff_t *ppos) +proc_dodebug (const struct ctl_table *table,int write,void *buffer, +size_t *lenp,loff_t *ppos) {char tmpbuf[20 ], *s =NULL ;char *p;
net/sunrpc/xprtrdma/svc_rdma.c +1 -1
@@ -74,7 +74,7 @@ enum { SVCRDMA_COUNTER_BUFSIZ = sizeof(unsigned long long), }; -static int svcrdma_counter_handler (struct ctl_table *table,int write, +static int svcrdma_counter_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct percpu_counter *stat = (struct percpu_counter *)table->data;
security/apparmor/lsm.c +1 -1
@@ -2036,7 +2036,7 @@ static int __init alloc_buffers(void) }#ifdef CONFIG_SYSCTL -static int apparmor_dointvec (struct ctl_table *table,int write, +static int apparmor_dointvec (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {if (!aa_current_policy_admin_capable (NULL ))
security/min_addr.c +1 -1
@@ -29,7 +29,7 @@ static void update_mmap_min_addr(void)* sysctl handler which just sets dac_mmap_min_addr = the new value and then * calls update_mmap_min_addr() so non MAP_FIXED hints get rounded properly */ -int mmap_min_addr_handler (struct ctl_table *table,int write, +int mmap_min_addr_handler (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {int ret;
security/yama/yama_lsm.c +1 -1
@@ -436,7 +436,7 @@ static struct security_hook_list yama_hooks[] __ro_after_init = { };#ifdef CONFIG_SYSCTL -static int yama_dointvec_minmax (struct ctl_table *table,int write, +static int yama_dointvec_minmax (const struct ctl_table *table,int write,void *buffer,size_t *lenp,loff_t *ppos) {struct ctl_table table_copy;
---
base-commit: 0c52056d9f77508cb6d4d68d3fc91c6c08ec71af
change-id: 20240615-sysctl-const-handler-27a7f4f70f57
Best regards,
Signature · 1 line
Thomas Weißschuh <[email protected]>
Quoted 26 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
Quoted 8 lines
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>
This looks good! I'll be glad to see these all be read-only. :)
Signature · 1 line
Kees Cook
Quoted 32 lines · Kees Cook
Quoted 31 lines · Thomas Wei�schuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.
Quoted 7 lines
Quoted 3 lines
No functional change.
Signed-off-by Thomas Wei�schuh <[email protected]>This looks good! I'll be glad to see these all be read-only. :)
Reviewed-by Kees Cook <[email protected]>
Since the patch and the coccinelle script changed, I removed your Reviewed-by tag from the commit that I sent. Just FYI.
Signature · 1 line
Joel Granados
Kees Cook
maintainerQuoted 35 lines · Joel Granados
Quoted 34 lines · Kees Cook
Quoted 33 lines · Thomas Wei?schuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.No functional change.
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Signed-off-by Thomas Wei?schuh <[email protected]>This looks good! I'll be glad to see these all be read-only. :)
Reviewed-by Kees Cook <[email protected]>Since the patch and the coccinelle script changed, I removed your Reviewed-by tag from the commit that I sent. Just FYI.
Totally reasonable. And the PR looks good. We'll see what Linus thinks! :)
Signature · 1 line
Kees Cook
Quoted 26 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
Quoted 8 lines
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>
Awesome stuff!!! thx.
Best
Signature · 1 line
Joel Granados
Quoted 26 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
Quoted 8 lines
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>
Will test this in 0-day in [1] to avoid potential conflicts with all the other stuff going into linux-next and because it does not apply cleanly to sysctl-next. Don't expect any issues from 0-day as it is a non-functional trivial change.
I'll use this patch as is when the time comes during the end of the merge window (at that point it should apply cleanly) and go into
@Thomas: Can I ping you during the merge window to double check that there are no additional proc_handlers (without the const argument) that might not be present in today's linux-next?
Best
Signature · 1 line
Joel Granados
Quoted 32 lines · Joel Granados
Quoted 31 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.
Quoted 7 lines
Quoted 3 lines
No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>Will test this in 0-day in [1] to avoid potential conflicts with all the other stuff going into linux-next and because it does not apply cleanly to sysctl-next. Don't expect any issues from 0-day as it is a non-functional trivial change.
Thanks!
Quoted 6 lines
I'll use this patch as is when the time comes during the end of the merge window (at that point it should apply cleanly) and go into
@Thomas: Can I ping you during the merge window to double check that there are no additional
proc_handlers(without the const argument) that might not be present in today's linux-next?
Sure, I'll test it from time to time anyways.
Quoted 26 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
Quoted 8 lines
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>
Luis
Quoted 31 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.
Quoted 4 lines
No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>---
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
@Thomas: Some questions
1. Are there any updates?
2. Does it still apply cleanly against the latest master branch?
3. Are you able to do the last update at the beginning of next week (Jul 22)?
Best
Signature · 1 line
Joel Granados
Quoted 32 lines · Joel Granados
Quoted 31 lines · Thomas Weißschuh
Adapt the
proc_handerfunction signature to make it clear that handlers are not supposed to modify theirctl_tableargument.This is also a prerequisite to moving the static
ctl_tablestructs into read-only data.The patch was mostly generated by coccinelle with the following script:
@@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... }In addition to the scripted changes some other changes are done:
* The "typedef
proc_handler" ininclude/linux/sysctl.his changed to use the "constctl_table".* The prototypes of non-static handlers in header-files are adapted to match the changes of their respective definitions.
*
kernel/watchdog.c:proc_watchdog_common()
This is called from aproc_handleritself and is als calling back into anotherproc_handler, making it necessary to change it as part of theproc_handlermigration.
Quoted 7 lines
Quoted 4 lines
No functional change.
Signed-off-by Thomas Weißschuh <[email protected]>---
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
Sounds good.
Quoted 3 lines
@Thomas: Some questions
1. Are there any updates?
No.
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires the net/ and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.
Quoted 2 lines
3. Are you able to do the last update at the beginning of next week (Jul 22)?
Sure.
Thomas
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 11 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
Sounds good.
Quoted 3 lines
@Thomas: Some questions
1. Are there any updates?
No.
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Quoted 5 lines
Quoted 3 lines
3. Are you able to do the last update at the beginning of next week (Jul 22)?
Sure.
Thx
[1] net: constify ctl_table arguments of utility functions
https://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*
Signature · 1 line
Joel Granados
Quoted 5 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 2 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
<snip>
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.
Quoted 6 lines
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Right, but...
It turns out the preparation patch for mm/hugetlb.c [0] is also still missing. I missed it in all the errors triggered in net/. But as far as I can see this patch will be part of Andrew's PR for mm.
Other than that it looks good.
<snip>
[0] https://lore.kernel.org/lkml/20240518-sysctl-const-handler-hugetlb-v1-1-47e34e2871b2@weissschuh.net/
Quoted 4 lines
[1] net: constify
ctl_tablearguments of utility functionshttps://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*
Quoted 25 lines · Thomas Weißschuh
Quoted 5 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 2 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
<snip>
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.Quoted 6 lines
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Quoted 5 lines
Right, but...
It turns out the preparation patch for
mm/hugetlb.c[0] is also still missing. I missed it in all the errors triggered innet/. But as far as I can see this patch will be part of Andrew's PR for mm.
Thx for the heads up, I'll Add that one to my radar of things that need to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
Quoted 8 lines
<snip>
[0] https://lore.kernel.org/lkml/20240518-sysctl-const-handler-hugetlb-v1-1-47e34e2871b2@weissschuh.net/
Quoted 4 lines
[1] net: constify
ctl_tablearguments of utility functionshttps://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*
[3] https://lore.kernel.org/[email protected]
Best
Signature · 1 line
Joel Granados
Hi Joel,
Quoted 28 lines · Joel Granados
Quoted 27 lines · Thomas Weißschuh
Quoted 5 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 2 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
<snip>
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.Quoted 6 lines
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Right, but...
Quoted 8 lines
Quoted 3 lines
It turns out the preparation patch for
mm/hugetlb.c[0] is also still missing. I missed it in all the errors triggered innet/. But as far as I can see this patch will be part of Andrew's PR for mm.Thx for the heads up, I'll Add that one to my radar of things that need to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
All dependency PRs (sysctl, net, mm) are now merged. My compilation tests all succeed now.
Quoted 10 lines
Quoted 8 lines
<snip>
[0] https://lore.kernel.org/lkml/20240518-sysctl-const-handler-hugetlb-v1-1-47e34e2871b2@weissschuh.net/
Quoted 4 lines
[1] net: constify
ctl_tablearguments of utility functionshttps://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*
Quoted 35 lines · Thomas Weißschuh
Hi Joel,
Quoted 32 lines · Joel Granados
Quoted 30 lines · Thomas Weißschuh
Quoted 5 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 2 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
<snip>
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.Quoted 6 lines
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Right, but...
It turns out the preparation patch for
mm/hugetlb.c[0] is also still missing. I missed it in all the errors triggered innet/. But as far as I can see this patch will be part of Andrew's PR for mm.
Quoted 7 lines
Quoted 4 lines
Thx for the heads up, I'll Add that one to my radar of things that need to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
All dependency PRs (sysctl, net, mm) are now merged. My compilation tests all succeed now.
Great. I'll push this up to Linus tomorrow as planned. Thx for the heads up.
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
<snip>
[0] https://lore.kernel.org/lkml/20240518-sysctl-const-handler-hugetlb-v1-1-47e34e2871b2@weissschuh.net/
Quoted 4 lines
[1] net: constify
ctl_tablearguments of utility functionshttps://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*
Best
Signature · 1 line
Joel Granados
Quoted 35 lines · Thomas Weißschuh
Hi Joel,
Quoted 32 lines · Joel Granados
Quoted 30 lines · Thomas Weißschuh
Quoted 5 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 2 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
<snip>
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.Quoted 6 lines
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Right, but...
It turns out the preparation patch for
mm/hugetlb.c[0] is also still missing. I missed it in all the errors triggered innet/. But as far as I can see this patch will be part of Andrew's PR for mm.
Quoted 7 lines
Quoted 4 lines
Thx for the heads up, I'll Add that one to my radar of things that need to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
All dependency PRs (sysctl, net, mm) are now merged. My compilation tests all succeed now.
How did you apply the coccinelle script? I ask because if I do this:
``` make coccicheck MODE=patch SPFLAGS="--in-place --include-headers" COCCI=SCRIPT ```
I have to add "virtual patch" to the first line of the script you had sent. So it would look like this:
```
virtual patch
@@
identifier func, ctl, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *ctl,
+ const struct ctl_table *ctl,
int write, void *buffer, size_t *lenp, loff_t *ppos)
{ ... }
```Additionally, this cocci script is not changing the header files. Even if I pass --include-headers. Did you change those by hand?
Best
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
<snip>
[0] https://lore.kernel.org/lkml/20240518-sysctl-const-handler-hugetlb-v1-1-47e34e2871b2@weissschuh.net/
Quoted 4 lines
[1] net: constify
ctl_tablearguments of utility functionshttps://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*
Signature · 1 line
Joel Granados
Quoted 51 lines · Joel Granados
Quoted 35 lines · Thomas Weißschuh
Hi Joel,
Quoted 32 lines · Joel Granados
Quoted 30 lines · Thomas Weißschuh
Quoted 5 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-15 22:23:19+0000, Joel Granados wrote:
...
Quoted 2 lines
Quoted 2 lines
The merge window is now open. I want to send this patch on the Wednesday of next week (jul 24).
<snip>
Quoted 9 lines
Quoted 8 lines
Quoted 1 line
2. Does it still apply cleanly against the latest master branch?
Not against mainline master, but against next-20240715.
To apply cleanly (and compile) on mainline master it still requires thenet/and sysctl trees to be merged.
Otherwise some modified functions are missing, leading to (trivial) merge conflicts or the preparation commits are missing, leading to compilation errors.Quoted 6 lines
Understood. I have just sent Linus the changes for sysctl-next, so those should land in master soon (baring any issues with the pull request).
These [1] and [2] are the two series in net-dev that are the deps for the constification treewide patch. Once these two go into mainline, then we are good to go. Right?
Right, but...
It turns out the preparation patch for
mm/hugetlb.c[0] is also still missing. I missed it in all the errors triggered innet/. But as far as I can see this patch will be part of Andrew's PR for mm.Quoted 7 lines
Quoted 4 lines
Thx for the heads up, I'll Add that one to my radar of things that need to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
All dependency PRs (sysctl, net, mm) are now merged. My compilation tests all succeed now.
How did you apply the coccinelle script? I ask because if I do this:
``` make coccicheck MODE=patch SPFLAGS="--in-place --include-headers" COCCI=SCRIPT ```I have to add "virtual patch" to the first line of the script you had sent. So it would look like this:
Quoted 13 lines
```
virtual patch
@@
identifier func, ctl, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *ctl,
+ const struct ctl_table *ctl,
int write, void *buffer, size_t *lenp, loff_t *ppos)
{ ... }
```Yes, IIRC I got told during one review to drop it. But for me it is also necessary.
Thinking back, there were other "virtual" lines, too. Maybe those were to ones that needed to be removed, but "virtual patch" should stay.
Quoted 2 lines
Additionally, this cocci script is not changing the header files. Even if I pass --include-headers. Did you change those by hand?
Yes, I changed these manually, originally.
To do it through the script, you need a second subpatch:
``` @@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); ```
(It doesn't find anything else, though)
Quoted 17 lines
Best
Quoted 11 lines
Quoted 11 lines
Quoted 9 lines
<snip>
[0] https://lore.kernel.org/lkml/20240518-sysctl-const-handler-hugetlb-v1-1-47e34e2871b2@weissschuh.net/
Quoted 4 lines
[1] net: constify
ctl_tablearguments of utility functionshttps://patchwork.kernel.org/project/netdevbpf/list/?series=856252&state=%2A&archive=both [2] bpf: constify member bpf_sysctl_kern::table https://patchwork.kernel.org/project/netdevbpf/list/?series=854191&state=*Signature · 1 line
Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-24 10:41:24+0000, Joel Granados wrote:
...
Quoted 28 lines
Quoted 14 lines
Quoted 6 lines
Quoted 3 lines
to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
All dependency PRs (sysctl, net, mm) are now merged. My compilation tests all succeed now.
How did you apply the coccinelle script? I ask because if I do this:
``` make coccicheck MODE=patch SPFLAGS="--in-place --include-headers" COCCI=SCRIPT ```I have to add "virtual patch" to the first line of the script you had sent. So it would look like this:
Quoted 13 lines
``` virtual patch @@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... } ```
Quoted 2 lines
Yes, IIRC I got told during one review to drop it. But for me it is also necessary.
I also remember a comment from the XFS part of the patches where you changed the formatting on some functions. What did you do to address this? Did you change them manually? Or do you have a script?
Quoted 4 lines
Thinking back, there were other "virtual" lines, too. Maybe those were to ones that needed to be removed, but "virtual patch" should stay.
Understood.
Quoted 8 lines
Quoted 3 lines
Additionally, this cocci script is not changing the header files. Even if I pass --include-headers. Did you change those by hand?
Yes, I changed these manually, originally.
To do it through the script, you need a second subpatch:
Quoted 10 lines
``` @@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); ```
Yes. But you are still missing one more subpatch to catch the function declarations in header files that don't name the arguments; like the ones in include/linux/mm.h. This is what I used for those:
``` @r3@ identifier func; @@ int func( - struct ctl_table *, + const struct ctl_table *, int , void *, size_t *, loff_t *); ```
Quoted 2 lines
(It doesn't find anything else, though)
Maybe you are missing running it with --include-headers?
This is the full cocci script that I have:
```
virtual patch
@r1@
identifier func, ctl, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *ctl,
+ const struct ctl_table *ctl,
int write, void *buffer, size_t *lenp, loff_t *ppos);
@r2@
identifier func, ctl, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *ctl,
+ const struct ctl_table *ctl,
int write, void *buffer, size_t *lenp, loff_t *ppos)
{ ... }
@r3@
identifier func;
@@
int func(
- struct ctl_table *,
+ const struct ctl_table *,
int , void *, size_t *, loff_t *);
```Signature · 1 line
Joel Granados
Quoted 31 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-24 10:41:24+0000, Joel Granados wrote:
...
Quoted 28 lines
Quoted 27 lines
Quoted 6 lines
Quoted 3 lines
to be in master before we send the PR to Linus. Will check these three dependencies on Wednesday next week and send your V2 [3] if I see that it applies cleanly.
All dependency PRs (sysctl, net, mm) are now merged. My compilation tests all succeed now.
How did you apply the coccinelle script? I ask because if I do this:
``` make coccicheck MODE=patch SPFLAGS="--in-place --include-headers" COCCI=SCRIPT ```I have to add "virtual patch" to the first line of the script you had sent. So it would look like this:
``` virtual patch @@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... } ```
Quoted 5 lines
Quoted 2 lines
Yes, IIRC I got told during one review to drop it. But for me it is also necessary.
I also remember a comment from the XFS part of the patches where you changed the formatting on some functions. What did you do to address this? Did you change them manually? Or do you have a script?
Yes, the style fixes were done manually.
Quoted 39 lines
Quoted 3 lines
Thinking back, there were other "virtual" lines, too. Maybe those were to ones that needed to be removed, but "virtual patch" should stay.
Understood.
Quoted 8 lines
Quoted 3 lines
Additionally, this cocci script is not changing the header files. Even if I pass --include-headers. Did you change those by hand?
Yes, I changed these manually, originally.
To do it through the script, you need a second subpatch:
Quoted 10 lines
``` @@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); ```Yes. But you are still missing one more subpatch to catch the function declarations in header files that don't name the arguments; like the ones in
include/linux/mm.h. This is what I used for those:``` @r3@ identifier func; @@ int func( - struct ctl_table *, + const struct ctl_table *, int , void *, size_t *, loff_t *); ```Quoted 1 line
Quoted 2 lines
Quoted 1 line
(It doesn't find anything else, though)
Maybe you are missing running it with --include-headers?
There seems to be a slight misunderstanding.
I meant that it does not find anything *new* on top of the existing patch, not that it can fully recreate the patch.
(I used --include-headers, undid one header hunk from the patch and validated that the hunk gets recreated)
Quoted 24 lines
This is the full cocci script that I have:
``` virtual patch @r1@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos); @r2@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl, + const struct ctl_table *ctl, int write, void *buffer, size_t *lenp, loff_t *ppos) { ... } @r3@
Quoted 8 lines
identifier func; @@ int func( - struct ctl_table *, + const struct ctl_table *, int , void *, size_t *, loff_t *); ```
LGTM, thanks.
Quoted 1 line · Thomas Weißschuh
On 2024-07-24 11:18:17+0000, Joel Granados wrote:
...
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
```
Yes, IIRC I got told during one review to drop it. But for me it is also necessary.
I also remember a comment from the XFS part of the patches where you changed the formatting on some functions. What did you do to address this? Did you change them manually? Or do you have a script?
Yes, the style fixes were done manually.
Ok. I have created some sed scripts to automate this.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Thinking back, there were other "virtual" lines, too.
...
Quoted 10 lines
Quoted 6 lines
int , void *,
size_t*,loff_t*);
```Quoted 2 lines
(It doesn't find anything else, though)
Maybe you are missing running it with --include-headers?
There seems to be a slight misunderstanding.
I meant that it does not find anything *new* on top of the existing patch, not that it can fully recreate the patch.
Sorry, misunderstood you.
Quoted 3 lines
(I used --include-headers, undid one header hunk from the patch and validated that the hunk gets recreated)
ok. That means that "--include-headers" is active.
I actually made further changes on the cocci script for it to catch all the corner cases that you did by hand. The patch changes substantially as now there are much less formatting issues introduced by the script. I'll include you as co-developed-by and in that way give you proper credit for your work.
In order to reproduce what I did you need to run [1] with this cocci script [2] and then run [3] with this sed script [4]. I have checked to see that the same files are changed. The difference between what you and I did is mainly that coccinelle does not make any formatting decisions.
Will create and send the PR shortly.
Best
[1]
``` make coccicheck MODE=patch SPFLAGS="--in-place --include-headers --smpl-spacing --jobs=8" COCCI=SCRIPT.cocci ```
[2]
```
virtual patch
@r1@
identifier ctl, write, buffer, lenp, ppos;
identifier func !~ "appldata_(timer|interval)_handler|sched_(rt|rr)_handler|rds_tcp_skbuf_handler|proc_sctp_do_(hmac_alg|rto_min|rto_max|udp_port|alpha_beta|auth|probe_interval)";
@@
int func(
- struct ctl_table *ctl
+ const struct ctl_table *ctl
,int write, void *buffer, size_t *lenp, loff_t *ppos);
@r2@
identifier func, ctl, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *ctl
+ const struct ctl_table *ctl
,int write, void *buffer, size_t *lenp, loff_t *ppos)
{ ... }
@r3@
identifier func;
@@
int func(
- struct ctl_table *
+ const struct ctl_table *
,int , void *, size_t *, loff_t *);
@r4@
identifier func, ctl;
@@
int func(
- struct ctl_table *ctl
+ const struct ctl_table *ctl
,int , void *, size_t *, loff_t *);
@r5@
identifier func, write, buffer, lenp, ppos;
@@
int func(
- struct ctl_table *
+ const struct ctl_table *
,int write, void *buffer, size_t *lenp, loff_t *ppos);
```[3]
``` sed --in-place -f /tmp/constfy_formating.sed fs/xfs/xfs_sysctl.c kernel/watchdog.c ```
[4]
``` s/^xfs_stats_clear_proc_handler(const struct ctl_table \*ctl,$/xfs_stats_clear_proc_handler(\ \tconst struct ctl_table\t*ctl,/ s/^xfs_panic_mask_proc_handler(const struct ctl_table \*ctl,$/xfs_panic_mask_proc_handler(\ \tconst struct ctl_table\t*ctl,/ s/^xfs_deprecated_dointvec_minmax(const struct ctl_table \*ctl,$/xfs_deprecated_dointvec_minmax(\ \tconst struct ctl_table\t*ctl,/ s/proc_watchdog_common(int which, struct ctl_table \*table/proc_watchdog_common(int which, const struct ctl_table *table/ ```
Signature · 1 line
Joel Granados
Quoted 32 lines · Joel Granados
Quoted 1 line · Thomas Weißschuh
On 2024-07-24 11:18:17+0000, Joel Granados wrote:
...
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
```
Yes, IIRC I got told during one review to drop it. But for me it is also necessary.
I also remember a comment from the XFS part of the patches where you changed the formatting on some functions. What did you do to address this? Did you change them manually? Or do you have a script?
Yes, the style fixes were done manually.
Ok. I have created some sed scripts to automate this.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
Thinking back, there were other "virtual" lines, too.
...
Quoted 10 lines
Quoted 6 lines
int , void *,
size_t*,loff_t*);
```Quoted 2 lines
(It doesn't find anything else, though)
Maybe you are missing running it with --include-headers?
There seems to be a slight misunderstanding.
I meant that it does not find anything *new* on top of the existing patch, not that it can fully recreate the patch.Sorry, misunderstood you.
Quoted 3 lines
(I used --include-headers, undid one header hunk from the patch and validated that the hunk gets recreated)
Quoted 7 lines
ok. That means that "--include-headers" is active.
I actually made further changes on the cocci script for it to catch all the corner cases that you did by hand. The patch changes substantially as now there are much less formatting issues introduced by the script. I'll include you as co-developed-by and in that way give you proper credit for your work.
Ok.
I ran the scripts and for the result:
Quoted 6 lines
In order to reproduce what I did you need to run [1] with this cocci script [2] and then run [3] with this sed script [4]. I have checked to see that the same files are changed. The difference between what you and I did is mainly that coccinelle does not make any formatting decisions.
Will create and send the PR shortly.
Ack.
Quoted 80 lines
Best
[1]
``` make coccicheck MODE=patch SPFLAGS="--in-place --include-headers --smpl-spacing --jobs=8" COCCI=SCRIPT.cocci ```[2]
``` virtual patch @r1@ identifier ctl, write, buffer, lenp, ppos; identifier func !~ "appldata_(timer|interval)_handler|sched_(rt|rr)_handler|rds_tcp_skbuf_handler|proc_sctp_do_(hmac_alg|rto_min|rto_max|udp_port|alpha_beta|auth|probe_interval)"; @@ int func( - struct ctl_table *ctl + const struct ctl_table *ctl ,int write, void *buffer, size_t *lenp, loff_t *ppos); @r2@ identifier func, ctl, write, buffer, lenp, ppos; @@ int func( - struct ctl_table *ctl + const struct ctl_table *ctl ,int write, void *buffer, size_t *lenp, loff_t *ppos) { ... } @r3@ identifier func; @@ int func( - struct ctl_table * + const struct ctl_table * ,int , void *, size_t *, loff_t *); @r4@ identifier func, ctl; @@ int func( - struct ctl_table *ctl + const struct ctl_table *ctl ,int , void *, size_t *, loff_t *); @r5@ identifier func, write, buffer, lenp, ppos; @@ int func( - struct ctl_table * + const struct ctl_table * ,int write, void *buffer, size_t *lenp, loff_t *ppos); ```[3]
``` sed --in-place -f /tmp/constfy_formating.sed fs/xfs/xfs_sysctl.c kernel/watchdog.c ```[4]
``` s/^xfs_stats_clear_proc_handler(const struct ctl_table \*ctl,$/xfs_stats_clear_proc_handler(\ \tconst struct ctl_table\t*ctl,/ s/^xfs_panic_mask_proc_handler(const struct ctl_table \*ctl,$/xfs_panic_mask_proc_handler(\ \tconst struct ctl_table\t*ctl,/ s/^xfs_deprecated_dointvec_minmax(const struct ctl_table \*ctl,$/xfs_deprecated_dointvec_minmax(\ \tconst struct ctl_table\t*ctl,/ s/proc_watchdog_common(int which, struct ctl_table \*table/proc_watchdog_common(int which, const struct ctl_table *table/ ```Signature · 1 line
Joel Granados