Received: by 2002:ab2:6486:0:b0:1ef:eae8:a797 with SMTP id de6csp143687lqb; Fri, 15 Mar 2024 19:53:02 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV1dyP+fB42o7vmb0OrAZxPx4kgVSV500gTlxrZbY7HXyN4+LGvXPpiUHspYjUkqs4716l20bZZ+nX3KMskyOxf2gSBzZ7gyZ4FqTrHFw== X-Google-Smtp-Source: AGHT+IGZEhnBjVmFShXMkb/hqVCafMLc/i+G5qb5JGTJb2hTnHqmkK69qScwO4XbRiuR6YKTqrql X-Received: by 2002:a17:902:e54c:b0:1dd:a33f:5916 with SMTP id n12-20020a170902e54c00b001dda33f5916mr5713694plf.4.1710557582068; Fri, 15 Mar 2024 19:53:02 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710557582; cv=pass; d=google.com; s=arc-20160816; b=KuATlKOoErHEMg6M6LqIHsqW73qsxCAnfXl/M9BYKUaBdpnP+Hheb8V5lf4xg4N1sA Qv2tLmcFtNyO3mZw1oeGa7EE8xomHBr8d5T9TQ2hxkx6X8SwVH1VedLKahPuCPLvWBvP C8mcBarvOy5JReIjmjiE6uPTnYTXY8959zR1UsCCNym9b2E1NbuMh4FX+MqeOWpJxNPe 5todTEZmAfzoipczlVweftIcYIh68lCb16a/2curLY8TgL4MiY3fMgvYKWe2OEDQzkH7 xcFpfjGBB/PhOaqvfD79+h2Au2AwplkAEQ0JU9BOcp9oHItrM0w5M7PCiGc2XfWKqjzl UewQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bBoX08MQ+GnGsn3Ys1XDLWs0vSpU6QZ104y6JQ1iJRA=; fh=Ht/fI71wxyUEY6Q1k3LPtJpJEhuU+MryaRzLXlRGeBg=; b=Foq1zilyGN5jfO6bdo5UwgQKbgcOT5mi9PCdbt23UtuFVFHHV6qRfp5mziny3+/kbm iHXi9us15fJmwmPe1I1erKDiy/OEuZC+YhzB8l3Jl4SweSRcnLTMNfzLZWTwhTmVGDm9 hKUxyBjpOtjofHjJiWW4RBjLQB0juWEJid9lBiPKBH2WEbK+3JoXwdvVevD7xaBXs+2m m4EyB3NNC+5PYii5jRV3HRWp4/4XujkoDJZqwLJQZEWmuwPj8NjI3QbHRgoTD2LeQrqb ArsRlb14/qeF/SVYbJE81Kd8CGa3K+Dv0nA1bbWHwxaxANhyq3oICoJKmz7F68IFohSj MFzQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=OS38TBQX; arc=pass (i=1 spf=pass spfdomain=fromorbit.com dkim=pass dkdomain=fromorbit-com.20230601.gappssmtp.com dmarc=pass fromdomain=fromorbit.com); spf=pass (google.com: domain of linux-nfs+bounces-2350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=fromorbit.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id lq11-20020a170903144b00b001dccf78c7dasi4784149plb.485.2024.03.15.19.53.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 19:53:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=OS38TBQX; arc=pass (i=1 spf=pass spfdomain=fromorbit.com dkim=pass dkdomain=fromorbit-com.20230601.gappssmtp.com dmarc=pass fromdomain=fromorbit.com); spf=pass (google.com: domain of linux-nfs+bounces-2350-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2350-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=QUARANTINE) header.from=fromorbit.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id AF34F282A8A for ; Sat, 16 Mar 2024 02:53:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C3954C61; Sat, 16 Mar 2024 02:52:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b="OS38TBQX" X-Original-To: linux-nfs@vger.kernel.org Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EDB0D28F5 for ; Sat, 16 Mar 2024 02:52:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.170 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710557576; cv=none; b=gy28tOu4+74VSIKeKXuOhNE0Evj3DIYS7FwlAMc9hZNsL/qoLeFrBc65THwqaNh2GyIWenqf3PmZH6ZhtBMXfzI/ZvNsTKih8eyfvqZ+tTvCKYI8SbmLneLuDedlmcX8EwwYynM9+SyF4oXuayNVJmPVGD75OTr/VkHdNvSGNgw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710557576; c=relaxed/simple; bh=ONoYL4XYOrO/6V38FWRzOpd8quw8P9OYCw818URL5SI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g03Q3KkahoP8M51VG/bK5wOdz1Bfef8AthiUcL/97jQQzBsi9e8rPqLOaBja82KLzrslM3NqlF50nwfY5rgUGCl5JOOBJGhQzM74p490AoRC1NDMYtvTfekP204qEBZbUY+xVomO+AVK8YbLC3k1/HIGmcbA8Ekbx1QTD72kZXg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com; spf=pass smtp.mailfrom=fromorbit.com; dkim=pass (2048-bit key) header.d=fromorbit-com.20230601.gappssmtp.com header.i=@fromorbit-com.20230601.gappssmtp.com header.b=OS38TBQX; arc=none smtp.client-ip=209.85.215.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fromorbit.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fromorbit.com Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-5cddc5455aeso2061126a12.1 for ; Fri, 15 Mar 2024 19:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1710557573; x=1711162373; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=bBoX08MQ+GnGsn3Ys1XDLWs0vSpU6QZ104y6JQ1iJRA=; b=OS38TBQXdJvmCPcBqtVgseCBD92KPMKjZB5CNB1A04ssBRuxFtzhRPn1GciuiaZp/t ZH5bJFCL/HpWMw666xaF9ceynO1+jhCFyauCWBZUGDOD1jkHbl+xoO/jG6Zp360GwjSj i66QeBxSRG87tkQkjPc2WA1M6sUtCwvS7DgrAnPORxwYyGeQf+wuJHESEF51ACE4d88K v4nAXQtE+CrgRNknVt8a/+cuKu8aypzYeDig59JPHUtRYsAH3lqkfrJopeugL+PkOFJP r/+/nAs2w8rmwShkaEIQMuFTq7jUIHueDrkctHW9aB3EK7WEeQJ4EnyrT3UmzNQXv8kk 1a+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710557573; x=1711162373; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=bBoX08MQ+GnGsn3Ys1XDLWs0vSpU6QZ104y6JQ1iJRA=; b=QW5tK9nf/Hn5Lk1VfhxrOEo9YEZhZO5D/RaxWCxe3GleKyEPWn2uPGVRYZI+i1rv5p kCDzTbs5MTsHaenk9uvp1G1nJNcn6Z3XAiv3+NvE/2FgdL53P1/iL5f8YTGOTlp4vWT8 Zwd9iXHKBNeb0gIjbSr9Pk1wk0uGtBxyjk4gCrojW/YKW5D6i8LmVzz1wKyEcRAYgLWh E4PB759ZzHyo+eLLEnkQB0i7159aAKwrBEXL5QC1H2fhhPfvucrOdbcrG+qzq3cTsiSZ DtGvGbalVfW9nhu2OX5YQZE5SrYQn845gz+9IRGfp9thNgWqtaO5rPPLNHWUvgcesnK/ yRMA== X-Forwarded-Encrypted: i=1; AJvYcCVYl1/KJWfY/8h7cBhcX8EfKR6KiCE4y6dDI8j0/dCdhzEbZVOE0eqwT95wEwkFxCF2q3YmiRmJac8k2uVhgqziZC8BZF689BP/ X-Gm-Message-State: AOJu0Yw4R2gI9vdsUmT+TTLBk60tEaloYz6qdJmXipblWc7C4679p/wp 4I20i0IOCtdBqKd9C6HTRVS4WMuWdyXWQq6ks2GKWenLKQyUpAUr14krtp98qKU= X-Received: by 2002:a17:903:2446:b0:1dd:9cb3:8f96 with SMTP id l6-20020a170903244600b001dd9cb38f96mr6055795pls.42.1710557572964; Fri, 15 Mar 2024 19:52:52 -0700 (PDT) Received: from dread.disaster.area (pa49-180-185-123.pa.nsw.optusnet.com.au. [49.180.185.123]) by smtp.gmail.com with ESMTPSA id f5-20020a170902684500b001dddbb58d5esm4736209pln.109.2024.03.15.19.52.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Mar 2024 19:52:52 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1rlKAC-002Wnj-2F; Sat, 16 Mar 2024 13:52:48 +1100 Date: Sat, 16 Mar 2024 13:52:48 +1100 From: Dave Chinner To: Thomas =?iso-8859-1?Q?Wei=DFschuh?= Cc: Greg Kroah-Hartman , Kees Cook , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Eduard Zingerman , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Muchun Song , Andrew Morton , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , David Ahern , Simon Horman , Julian Anastasov , Pablo Neira Ayuso , Jozsef Kadlecsik , Florian Westphal , Luis Chamberlain , Joel Granados , Catalin Marinas , Will Deacon , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Gerald Schaefer , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Phillip Potter , Theodore Ts'o , "Jason A. Donenfeld" , Sudip Mukherjee , Mark Rutland , Atish Patra , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Alexander Viro , Christian Brauner , Jan Kara , Eric Biederman , Chandan Babu R , "Darrick J. Wong" , Steven Rostedt , Masami Hiramatsu , Peter Zijlstra , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Ian Rogers , Adrian Hunter , Balbir Singh , "Naveen N. Rao" , Anil S Keshavamurthy , Petr Mladek , John Ogness , Sergey Senozhatsky , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Andy Lutomirski , Will Drewry , John Stultz , Stephen Boyd , Mathieu Desnoyers , "Matthew Wilcox (Oracle)" , Roopa Prabhu , Nikolay Aleksandrov , Remi Denis-Courmont , Allison Henderson , Marcelo Ricardo Leitner , Xin Long , Chuck Lever , Jeff Layton , Neil Brown , Olga Kornievskaia , Dai Ngo , Tom Talpey , Trond Myklebust , Anna Schumaker , John Johansen , Paul Moore , James Morris , "Serge E. Hallyn" , Alexander Popov , linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, lvs-devel@vger.kernel.org, netfilter-devel@vger.kernel.org, coreteam@netfilter.org, linux-fsdevel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-xfs@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, kexec@lists.infradead.org, bridge@lists.linux.dev, linux-rdma@vger.kernel.org, rds-devel@oss.oracle.com, linux-sctp@vger.kernel.org, linux-nfs@vger.kernel.org, apparmor@lists.ubuntu.com, linux-security-module@vger.kernel.org Subject: Re: [PATCH 11/11] sysctl: treewide: constify the ctl_table argument of handlers Message-ID: References: <20240315-sysctl-const-handler-v1-0-1322ac7cb03d@weissschuh.net> <20240315-sysctl-const-handler-v1-11-1322ac7cb03d@weissschuh.net> Precedence: bulk X-Mailing-List: linux-nfs@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20240315-sysctl-const-handler-v1-11-1322ac7cb03d@weissschuh.net> On Fri, Mar 15, 2024 at 09:48:09PM +0100, Thomas Wei?schuh wrote: > Adapt the proc_hander function signature to make it clear that handlers > are not supposed to modify their ctl_table argument. > > This is a prerequisite to moving the static ctl_table structs into > .rodata. > By migrating all handlers at once a lengthy transition can be avoided. > > 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) > { ... } Which seems to have screwed up the formatting of the XFS code... > diff --git a/fs/xfs/xfs_sysctl.c b/fs/xfs/xfs_sysctl.c > index a191f6560f98..a3ca192eca79 100644 > --- a/fs/xfs/xfs_sysctl.c > +++ b/fs/xfs/xfs_sysctl.c > @@ -10,12 +10,11 @@ static struct ctl_table_header *xfs_table_header; > > #ifdef CONFIG_PROC_FS > STATIC int > -xfs_stats_clear_proc_handler( > - struct ctl_table *ctl, > - int write, > - void *buffer, > - size_t *lenp, > - loff_t *ppos) > +xfs_stats_clear_proc_handler(const struct ctl_table *ctl, > + int write, > + void *buffer, > + size_t *lenp, > + loff_t *ppos) ... because this doesn't match any format I've ever seen in the kernel. The diff for this change shold be just: @@ -10,7 +10,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, > { > int ret, *valp = ctl->data; > > @@ -30,12 +29,11 @@ xfs_stats_clear_proc_handler( > } > > STATIC int > -xfs_panic_mask_proc_handler( > - struct ctl_table *ctl, > - int write, > - void *buffer, > - size_t *lenp, > - loff_t *ppos) > +xfs_panic_mask_proc_handler(const struct ctl_table *ctl, > + int write, > + void *buffer, > + size_t *lenp, > + loff_t *ppos) > { > int ret, *valp = ctl->data; > > @@ -51,12 +49,11 @@ xfs_panic_mask_proc_handler( > #endif /* CONFIG_PROC_FS */ > > STATIC int > -xfs_deprecated_dointvec_minmax( > - struct ctl_table *ctl, > - int write, > - void *buffer, > - size_t *lenp, > - loff_t *ppos) > +xfs_deprecated_dointvec_minmax(const struct ctl_table *ctl, > + int write, > + void *buffer, > + size_t *lenp, > + loff_t *ppos) > { > if (write) { > printk_ratelimited(KERN_WARNING And these need fixing as well. A further quick glance at the patch reveals that there are other similar screwed up conversions as well. > diff --git a/kernel/delayacct.c b/kernel/delayacct.c > index 6f0c358e73d8..513791ef573d 100644 > --- a/kernel/delayacct.c > +++ b/kernel/delayacct.c > @@ -44,8 +44,9 @@ 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; Like this. > diff --git a/kernel/events/core.c b/kernel/events/core.c > index 724e6d7e128f..e2955e0d9f44 100644 > --- a/kernel/events/core.c > +++ b/kernel/events/core.c > @@ -450,7 +450,8 @@ 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; And this. > @@ -474,8 +475,10 @@ 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, > - void *buffer, size_t *lenp, loff_t *ppos) > +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); > And this. > diff --git a/kernel/hung_task.c b/kernel/hung_task.c > index b2fc2727d654..003f0f5cb111 100644 > --- a/kernel/hung_task.c > +++ b/kernel/hung_task.c > @@ -239,9 +239,10 @@ 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; > And this. > diff --git a/kernel/latencytop.c b/kernel/latencytop.c > index 781249098cb6..0a5c22b19821 100644 > --- a/kernel/latencytop.c > +++ b/kernel/latencytop.c > @@ -65,8 +65,9 @@ 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; > And this. I could go on, but there are so many examples of this in the patch that I think that it needs to be toosed away and regenerated in a way that doesn't trash the existing function parameter formatting. -Dave. -- Dave Chinner david@fromorbit.com