[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5a1e45fd0bb89faa906866b7525210f4aaecab2e.camel@redhat.com>
Date: Tue, 19 Mar 2024 15:47:59 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>, linux@...ssschuh.net
Cc: davem@...emloft.net, dmitry.torokhov@...il.com, ebiederm@...ssion.com,
edumazet@...gle.com, j.granados@...sung.com, kuba@...nel.org,
linux-kernel@...r.kernel.org, mcgrof@...nel.org, netdev@...r.kernel.org
Subject: Re: [PATCH] net: always initialize sysctl ownership
On Fri, 2024-03-15 at 17:39 -0700, Kuniyuki Iwashima wrote:
> on Fri, 15 Mar 2024 17:20:31 +0100 Thomas Weißschuh <linux@...ssschuh.net wrote:
>
> > diff --git a/net/sysctl_net.c b/net/sysctl_net.c
> > index 051ed5f6fc93..03e320ddacc9 100644
> > --- a/net/sysctl_net.c
> > +++ b/net/sysctl_net.c
> > @@ -62,12 +62,10 @@ static void net_ctl_set_ownership(struct ctl_table_header *head,
> > kgid_t ns_root_gid;
> >
> > ns_root_uid = make_kuid(net->user_ns, 0);
> > - if (uid_valid(ns_root_uid))
> > - *uid = ns_root_uid;
> > + *uid = uid_valid(ns_root_uid) ? ns_root_uid : GLOBAL_ROOT_UID;
> >
> > ns_root_gid = make_kgid(net->user_ns, 0);
> > - if (gid_valid(ns_root_gid))
> > - *gid = ns_root_gid;
> > + *gid = gid_valid(ns_root_gid) ? ns_root_gid : GLOBAL_ROOT_GID;
> > }
>
> How about setting the default in proc_sys_make_inode() instead ?
> because the default value configured by new_inode() is not
I also think that could be a better option, as the caller is already
providing default values in some cases.
Cheers,
Paolo
Powered by blists - more mailing lists