The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Joel Granados <joel.granados@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	David Ahern <dsahern@kernel.org>,
	Ido Schimmel <idosch@nvidia.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Xin Long <lucien.xin@gmail.com>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	"D. Wythe" <alibuda@linux.alibaba.com>,
	Dust Li <dust.li@linux.alibaba.com>,
	Sidraya Jayagond <sidraya@linux.ibm.com>,
	Wenjia Zhang <wenjia@linux.ibm.com>,
	Mahanta Jambigi <mjambigi@linux.ibm.com>,
	Tony Lu <tonylu@linux.alibaba.com>,
	Wen Gu <guwen@linux.alibaba.com>,
	Kuniyuki Iwashima <kuniyu@google.com>,
	Stefano Garzarella <sgarzare@redhat.com>,
	chia-yu.chang@nokia-bell-labs.com, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org,
	coreteam@netfilter.org, linux-sctp@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-s390@vger.kernel.org,
	virtualization@lists.linux.dev
Subject: Re: [PATCH v4 0/3] net: sysctl: Const Qualify sysctl ctl_table arrays
Date: Thu, 13 Aug 2026 10:17:02 +0100	[thread overview]
Message-ID: <20260813091702.GA196815@horms.kernel.org> (raw)
In-Reply-To: <20260810-jag-net_const_qualify-v4-0-77e888237c69@kernel.org>

On Mon, Aug 10, 2026 at 03:01:01PM +0200, Joel Granados wrote:
> What?
> =====
> We do two things:
> 1. Reject netns-unsafe: Replace warning and file permission change with
>    an error (reject registration) when an "unsafe" net sysctl
>    registration is detected.
> 2. Const qualify: Const qualify network templated ctl_table arrays and
>    unconditional kmemdup'ed ctl_table arrays.
> 
> Why?
> ====
> The main motivation for this is to continue with the const qualification
> of the ctl_table arrays [1]. The permission change inside
> ensure_safe_net_sysctl disallows cons qualifiaction as it basically
> modifies the entries before running the sysctl registration.
> 
>       ent->mode &= ~0222;
> 
> On reject netns-unsafe?
> =======================
> * I believe that there is currently now way that the permission change
>   gets executed [2]
> * I found one case where the warning message was posted to lore
>   (vsock_sysctl_register) [3], but it made its to mainline as part of
>   the second case in [2].
> * We should error anyway because writing to the global sysctl value
>   through a child netns is indicative of a bug [4].
> 
> On Const qualification?
> =======================
> We can separate the places where network registers sysctl tables into
> three groups:
> 1. Static global: The unchanged global static arrays are passed along to
>    sysctl register.
> 2. Always kmemdup: The global static arrays are always kmemdup'ed before
>    passing them along to sysctl register.
> 3. Dynamic global: The global static array is changed in place before
>    passing it along to sysctl register.
> 
> This series handles case 1 and 2. It leaves 3 for a later point as
> const qualifying those global ctl_tables is more involved.
> 
> I would be very thankful if you point me to anything that I have missed
> in my analysis that shows that this cannot/shouldn't be done.

For the series:

Reviewed-by: Simon Horman <horms@kernel.org>


  parent reply	other threads:[~2026-08-13  9:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-10 13:01 [PATCH v4 0/3] net: sysctl: Const Qualify sysctl ctl_table arrays Joel Granados
2026-08-10 13:01 ` [PATCH v4 1/3] net: enforce net sysctl registration Joel Granados
2026-08-10 13:01 ` [PATCH v4 2/3] net: Const qualify ctl_tables that kmemdup unconditionally Joel Granados
2026-08-10 13:01 ` [PATCH v4 3/3] net: Const qualify network templated ctl_tables Arrays Joel Granados
2026-08-13  9:17 ` Simon Horman [this message]
2026-08-13 11:40 ` [PATCH v4 0/3] net: sysctl: Const Qualify sysctl ctl_table arrays patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260813091702.GA196815@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=alibuda@linux.alibaba.com \
    --cc=chia-yu.chang@nokia-bell-labs.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=dust.li@linux.alibaba.com \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=guwen@linux.alibaba.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=idosch@nvidia.com \
    --cc=joel.granados@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=marcelo.leitner@gmail.com \
    --cc=mjambigi@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pablo@netfilter.org \
    --cc=phil@nwl.cc \
    --cc=sgarzare@redhat.com \
    --cc=sidraya@linux.ibm.com \
    --cc=steffen.klassert@secunet.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=virtualization@lists.linux.dev \
    --cc=wenjia@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox