From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Cc: linux-kernel@vger.kernel.org, "Jason Wang" <jasowangio@gmail.com>,
"Eugenio Pérez" <eperezma@redhat.com>,
"Xuan Zhuo" <xuanzhuo@linux.alibaba.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
netdev@vger.kernel.org, virtualization@lists.linux.dev,
"Rusty Russell" <rusty@rustcorp.com.au>,
"Max Krasnyansky" <maxk@qualcomm.com>,
"Jonathan Corbet" <corbet@lwn.net>,
"Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Simon Horman" <horms@kernel.org>,
linux-doc@vger.kernel.org
Subject: Re: [PATCH net-next v2 5/7] net: add a sysctl to opt out of virtio net hdr checksum validation
Date: Fri, 16 Oct 2026 21:09:27 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.32f6b1ecd121a@gmail.com> (raw)
In-Reply-To: <20261016143944-mutt-send-email-mst@kernel.org>
> > > > > > Should this be a global sysctl, rather than per netns?
> > > > >
> > > > >
> > > > > For customers I work with, it would be much less useful.
> > > >
> > > > Third option: make it an integer rather than a boolean.
> > > >
> > > > 0: no validation
> > > > 1: current level of validation
> > > > 2 and beyond: if we have to extend it later
> > > >
> > > > Not pretty, I'll admit. So fine to keep as is too if you prefer.
> > > > But I do foresee more changes in this area, if history is a guide.
> > > >
> > > > >
> > > > > > Even if per-netns, most likely do not want it writable by netns root
> > > > > > with user namespaces.
> > > > > >
> > > > > > That is the equivalent of ns_capable(CAP_NET_RAW), which is the cause
> > > > > > of many crashes due to bad packets ingested by, e.g., a packet socket.
> > > > >
> > > > > Hmm, yes i get that. Two knobs? a. verify b. the per netns value ro? Both
> > > > > on by default?
> > > >
> > > > A single system wide field is simplest.
> > > >
> > > > Is there a benefit to making this configurable on a per netns basis?
> > >
> > > As I tried to explain: a specific container breaks, you decide to trust it,
> > > you do not need to trust all.
> >
> > Ok
> >
> > > > If so, that's fine too. As long as root-in-namespace cannot modify it,
> > > > so readonly indeed.
> > >
> > >
> > > Right. So I envision along the lines of:
> > >
> > > net.core.virtio_net_hdr_validate_all - validate packets from any netns,
> > > netns root can not change it, only host root
> > >
> > > net.core.virtio_net_hdr_validate - per netns
> >
> > Then skip the global option, as it's just a convenience: the same can be
> > achieved by iterating over all the per-netns settings.
> >
> > Per netns validation, but only settable by root, not by root-in-namespace.
>
> Hmm I don't know how to achieve that. Are there examples of such
> options?
Two examples, both basically make the sysctl writable by root-in-ns,
but then add an extra capable() check in the write handler.
ipvs max_conn: in proc_do_conn_max()
if (write && !rc && val != unset) {
struct netns_ipvs *ipvs = table->extra2;
bool priv = capable(CAP_NET_ADMIN);
int max;
mutex_lock(&ipvs->service_mutex);
/* Unprivileged admins can not go above the hard limit */
max = priv ? IP_VS_CONN_MAX : ipvs->conn_max_limit;
if (val < 0 || val > max) {
rc = -EINVAL;
ns_last_pid, which in its original commit b8f566b04d3c ("sysctl: add
the kernel.ns_last_pid control")had a direct capable check (it was
later relaxed):
static int pid_ns_ctl_handler(struct ctl_table *table, int write,
void __user *buffer, size_t *lenp, loff_t *ppos)
{
struct ctl_table tmp = *table;
if (write && !capable(CAP_SYS_ADMIN))
return -EPERM;
next prev parent reply other threads:[~2026-10-17 1:09 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-15 12:41 [PATCH net-next v2 0/7] more virtio-net csum hardening Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 1/7] net: account for ingress-resolved virtio net hdr state Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 2/7] um: vector: honor virtio net hdr conversion failures Michael S. Tsirkin
2026-10-15 12:47 ` Johannes Berg
2026-10-15 12:52 ` Michael S. Tsirkin
2026-10-15 12:55 ` Johannes Berg
2026-10-16 9:37 ` Michael S. Tsirkin
2026-10-16 9:43 ` Michael S. Tsirkin
2026-10-16 9:44 ` Johannes Berg
2026-10-16 9:47 ` Michael S. Tsirkin
2026-10-16 9:49 ` Johannes Berg
2026-10-16 9:53 ` Michael S. Tsirkin
2026-10-15 17:19 ` Willem de Bruijn
2026-10-16 9:40 ` Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 3/7] um: vector: trim skbs before verifying the header Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 4/7] net: resolve uncommon partial checksums at ingress Michael S. Tsirkin
2026-10-15 17:43 ` Willem de Bruijn
2026-10-15 19:18 ` Chris Arges
2026-10-16 9:34 ` Michael S. Tsirkin
2026-10-16 9:36 ` Michael S. Tsirkin
2026-10-15 18:04 ` Willem de Bruijn
2026-10-15 18:07 ` Willem de Bruijn
2026-10-16 10:02 ` Michael S. Tsirkin
2026-10-15 12:41 ` [PATCH net-next v2 5/7] net: add a sysctl to opt out of virtio net hdr checksum validation Michael S. Tsirkin
2026-10-15 17:50 ` Willem de Bruijn
2026-10-16 9:33 ` Michael S. Tsirkin
2026-10-16 15:30 ` Willem de Bruijn
2026-10-16 17:51 ` Michael S. Tsirkin
2026-10-16 18:19 ` Willem de Bruijn
2026-10-16 18:40 ` Michael S. Tsirkin
2026-10-17 1:09 ` Willem de Bruijn [this message]
2026-10-16 17:55 ` Michael S. Tsirkin
2026-10-16 18:17 ` Willem de Bruijn
2026-10-15 12:41 ` [PATCH net-next v2 6/7] net: add ip4_parse() Michael S. Tsirkin
2026-10-15 18:51 ` Phil Sutter
2026-10-16 11:56 ` Björn Töpel
2026-10-15 12:41 ` [PATCH net-next v2 7/7] virtio_net: cleanup protocol calculation Michael S. Tsirkin
2026-10-16 11:52 ` Björn Töpel
2026-10-15 19:21 ` [PATCH net-next v2 0/7] more virtio-net csum hardening Chris Arges
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=willemdebruijn.kernel.32f6b1ecd121a@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=eperezma@redhat.com \
--cc=horms@kernel.org \
--cc=jasowangio@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maxk@qualcomm.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rdunlap@infradead.org \
--cc=rusty@rustcorp.com.au \
--cc=skhan@linuxfoundation.org \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.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
all inboxes | Powered by JetHome®