linux-hams.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Granados <joel.granados@gmail.com>
To: Przemek Kitszel <przemyslaw.kitszel@intel.com>
Cc: Wen Gu <guwen@linux.alibaba.com>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Pablo Neira Ayuso <pablo@netfilter.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Nikolay Aleksandrov <razor@blackwall.org>,
	Alexander Aring <alex.aring@gmail.com>,
	linux-sctp@vger.kernel.org,
	Miquel Raynal <miquel.raynal@bootlin.com>,
	Jan Karcher <jaka@linux.ibm.com>,
	Mat Martineau <martineau@kernel.org>,
	Will Deacon <will@kernel.org>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Stefan Schmidt <stefan@datenfreihafen.org>,
	Steffen Klassert <steffen.klassert@secunet.com>,
	linux-s390@vger.kernel.org, rds-devel@oss.oracle.com,
	Xin Long <lucien.xin@gmail.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	linux-rdma@vger.kernel.org, Tony Lu <tonylu@linux.alibaba.com>,
	bridge@lists.linux-foundation.org, willy@infradead.org,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	lvs-devel@vger.kernel.org
Subject: Re: [PATCH v2 11/14] networking: Update to register_net_sysctl_sz
Date: Tue, 8 Aug 2023 17:23:38 +0200	[thread overview]
Message-ID: <20230808152338.aoubpvauxpcuwfuz@localhost> (raw)
In-Reply-To: <22e0e672-f9f6-6afe-6ce6-63de264e7b6d@intel.com>

[-- Attachment #1: Type: text/plain, Size: 2217 bytes --]

On Tue, Aug 08, 2023 at 01:20:36PM +0200, Przemek Kitszel wrote:
> On 7/31/23 09:17, Joel Granados wrote:
> > Move from register_net_sysctl to register_net_sysctl_sz for all the
> > networking related files. Do this while making sure to mirror the NULL
> > assignments with a table_size of zero for the unprivileged users.
> > 
> > We need to move to the new function in preparation for when we change
> > SIZE_MAX to ARRAY_SIZE() in the register_net_sysctl macro. Failing to do
> > so would erroneously allow ARRAY_SIZE() to be called on a pointer. We
> > hold off the SIZE_MAX to ARRAY_SIZE change until we have migrated all
> > the relevant net sysctl registering functions to register_net_sysctl_sz
> > in subsequent commits.
> > 
> > An additional size function was added to the following files in order to
> > calculate the size of an array that is defined in another file:
> >      include/net/ipv6.h
> >      net/ipv6/icmp.c
> >      net/ipv6/route.c

...

> > diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> > index 64e873f5895f..51c6cdae8723 100644
> > --- a/net/ipv6/route.c
> > +++ b/net/ipv6/route.c
> > @@ -6447,14 +6447,19 @@ struct ctl_table * __net_init ipv6_route_sysctl_init(struct net *net)
> >   		table[8].data = &net->ipv6.sysctl.ip6_rt_min_advmss;
> >   		table[9].data = &net->ipv6.sysctl.ip6_rt_gc_min_interval;
> >   		table[10].data = &net->ipv6.sysctl.skip_notify_on_dev_down;
> > -
> > -		/* Don't export sysctls to unprivileged users */
> > -		if (net->user_ns != &init_user_ns)
> > -			table[1].procname = NULL;
Here I remove the setting of the procname to NULL for ipv6 sysctl
registers in route.c and I do not replace that assignment anywhere.
This means that we will export sysctls to unprivilged users for ipv6.
I'll correct this in V3.

> >   	}
> >   	return table;
> >   }
> > +
> > +size_t ipv6_route_sysctl_table_size(struct net *net)
> > +{
> > +	/* Don't export sysctls to unprivileged users */
> > +	if (net->user_ns != &init_user_ns)
> > +		return 0;
> > +
> > +	return ARRAY_SIZE(ipv6_route_table_template);
> > +}
> >   #endif
> >   static int __net_init ip6_route_net_init(struct net *net)

-- 

Joel Granados

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  parent reply	other threads:[~2023-08-08 15:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-31  7:17 [PATCH v2 00/14] sysctl: Add a size argument to register functions in sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 01/14] sysctl: Prefer ctl_table_header in proc_sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 02/14] sysctl: Use ctl_table_header in list_for_each_table_entry Joel Granados
2023-07-31  7:17 ` [PATCH v2 03/14] sysctl: Add ctl_table_size to ctl_table_header Joel Granados
     [not found]   ` <20230731071728.3493794-4-j.granados-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2023-07-31 18:30     ` Simon Horman
2023-07-31 19:07       ` Simon Horman
2023-08-01 10:03         ` Joel Granados
2023-07-31  7:17 ` [PATCH v2 04/14] sysctl: Add size argument to init_header Joel Granados
2023-07-31  7:17 ` [PATCH v2 05/14] sysctl: Add a size arg to __register_sysctl_table Joel Granados
2023-07-31  7:17 ` [PATCH v2 06/14] sysctl: Add size to register_sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 07/14] sysctl: Add size arg to __register_sysctl_init Joel Granados
2023-07-31  7:17 ` [PATCH v2 08/14] sysctl: Add size to register_net_sysctl function Joel Granados
2023-07-31  7:17 ` [PATCH v2 09/14] ax.25: Update to register_net_sysctl_sz Joel Granados
     [not found] ` <20230731071728.3493794-1-j.granados-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2023-07-31  7:17   ` [PATCH v2 10/14] netfilter: " Joel Granados
2023-08-01  6:11     ` Julian Anastasov
2023-07-31  7:17   ` [PATCH v2 11/14] networking: " Joel Granados
2023-08-08 11:20     ` Przemek Kitszel
2023-08-08 14:24       ` Joel Granados
2023-08-08 15:23       ` Joel Granados [this message]
2023-07-31  7:17 ` [PATCH v2 12/14] vrf: " Joel Granados
2023-07-31  7:17 ` [PATCH v2 13/14] sysctl: SIZE_MAX->ARRAY_SIZE in register_net_sysctl Joel Granados
2023-07-31  7:17 ` [PATCH v2 14/14] sysctl: Use ctl_table_size as stopping criteria for list macro Joel Granados
2023-07-31 20:50 ` [PATCH v2 00/14] sysctl: Add a size argument to register functions in sysctl Luis Chamberlain
2023-08-01 10:01   ` Joel Granados
2023-07-31 21:36 ` Luis Chamberlain
2023-08-01  9:35   ` Joel Granados
2023-08-07 21:44   ` Luis Chamberlain
2023-08-07 23:00     ` Chris Maness
2023-08-07 23:43       ` Luis Chamberlain
2023-08-08  2:50         ` Chris Maness
2023-08-08  3:00           ` Luis Chamberlain
2023-08-08  3:07             ` Chris Maness
2023-08-08 13:59               ` Joel Granados
2023-08-08 13:58           ` Joel Granados
2023-08-08  2:09     ` Jakub Kicinski
2023-08-08  2:34       ` Luis Chamberlain

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=20230808152338.aoubpvauxpcuwfuz@localhost \
    --to=joel.granados@gmail.com \
    --cc=agordeev@linux.ibm.com \
    --cc=alex.aring@gmail.com \
    --cc=bridge@lists.linux-foundation.org \
    --cc=catalin.marinas@arm.com \
    --cc=guwen@linux.alibaba.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=jaka@linux.ibm.com \
    --cc=kadlec@netfilter.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=lvs-devel@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=martineau@kernel.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=pablo@netfilter.org \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=razor@blackwall.org \
    --cc=rds-devel@oss.oracle.com \
    --cc=stefan@datenfreihafen.org \
    --cc=steffen.klassert@secunet.com \
    --cc=tonylu@linux.alibaba.com \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).