From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1722B130E4A for ; Wed, 24 Jul 2024 21:29:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721856585; cv=none; b=KD+q1Ny1bSYkwAKGNW9VGSHsmu+95lo4rfHXBPVrHu4W1izkZtmiksdK0rYT3MafxVuIAAg66omQjDzhNMT4J8D7+Yeadd8whvz4m6SPrprbw/3WuNoQE1UQVTwbzHJdklJw/ijjJeTlxMy+9Zxa4aqibHnvvDZ2SZr3yCzMkQE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721856585; c=relaxed/simple; bh=18rnGem7e13jKpgFjzhnWDWQAudSKur6+FRXxJB2pko=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uek1M8u0pl6O8vSd85SB6airso8jZi/2mGrsHyte9qu4QY5AUXVg/2p8sxpTT0EayKILcx9cgIibGllUP2oCmSBE62IWfOc8hDOUU4SBkF6RU0h6QtTBZZ7cJsaCq0V2u5OzVR1GuORnOIlk3QjEuWbSQQ2mEYO/sxMBNBa/fWg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DNfSy0q9; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DNfSy0q9" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DE4EEC32781; Wed, 24 Jul 2024 21:29:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1721856584; bh=18rnGem7e13jKpgFjzhnWDWQAudSKur6+FRXxJB2pko=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DNfSy0q9bmGO2r3f5jJgGHxl/aLbI/YgGFde6x1S5JVNAr04mYr7atNlw90V+3Ye+ fn7PwmMpQj53OHAVCN+xN/5QIjdH+p77N1vsbwZ5XWeqc6wFg5vnS3Fb5cEZEofe/M x1BUhFR8IeBz6HjKeVV1TIj8/b9dPF17wKo5zruzwz1XNQcfvo+v1SMZIoAO6kIGtE ghRTWEdirr5AfDrtZ1Gi/ld3ya+tZlXTIE2NgC0+YETq4pVMxnnZUCSpyGMuM2+Flt evgS+Nz5cCFsshJu8l5841w7bZGnWS1t00wFN23Hhj+sbYsgXT4G6MFOu0fQ2Jmfq5 94LoeTacuYN4Q== Date: Wed, 24 Jul 2024 14:29:44 -0700 From: Kees Cook To: Joel Granados Cc: Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Luis Chamberlain , Andrew Morton , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] sysctl: treewide: constify the ctl_table argument of proc_handlers Message-ID: <202407241429.B78BBA419@keescook> References: <20240619-sysctl-const-handler-v2-1-e36d00707097@weissschuh.net> <202406191350.BB98FF1@keescook> <20240724210509.b3n7eefakigdn2i5@joelS2.panther.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240724210509.b3n7eefakigdn2i5@joelS2.panther.com> On Wed, Jul 24, 2024 at 11:05:09PM +0200, Joel Granados wrote: > On Wed, Jun 19, 2024 at 01:51:15PM -0700, Kees Cook wrote: > > On Wed, Jun 19, 2024 at 12:09:00PM +0200, 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 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. > > > > > > Signed-off-by: Thomas Wei?schuh > > > > This looks good! I'll be glad to see these all be read-only. :) > > > > Reviewed-by: Kees Cook > 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! :) -- Kees Cook