lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAL+tcoDo8-q_pkQBTSMM9v7ESZKO2v5aTK=W1mLxF3JJutBjYA@mail.gmail.com>
Date: Mon, 30 Sep 2024 19:14:27 +0800
From: Jason Xing <kerneljasonxing@...il.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, 
	pabeni@...hat.com, dsahern@...nel.org, shuah@...nel.org, willemb@...gle.com, 
	linux-kselftest@...r.kernel.org, netdev@...r.kernel.org, 
	Jason Xing <kernelxing@...cent.com>
Subject: Re: [PATCH net-next 3/3] net-timestamp: namespacify the sysctl_tstamp_allow_data

On Mon, Sep 30, 2024 at 6:47 PM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> Jason Xing wrote:
> > From: Jason Xing <kernelxing@...cent.com>
> >
> > Let it be tuned in per netns by admins.
> >
> > Signed-off-by: Jason Xing <kernelxing@...cent.com>
>
> +1 on the idea
>
> > ---
> >  include/net/netns/core.h   |  1 +
> >  include/net/sock.h         |  2 --
>
> also remove the static global from sock.c

Thanks for pointing this out.

>
> >  net/core/net_namespace.c   |  1 +
> >  net/core/skbuff.c          |  2 +-
> >  net/core/sysctl_net_core.c | 18 +++++++++---------
> >  5 files changed, 12 insertions(+), 12 deletions(-)
> >
> > diff --git a/include/net/netns/core.h b/include/net/netns/core.h
> > index 78214f1b43a2..ef8b3105c632 100644
> > --- a/include/net/netns/core.h
> > +++ b/include/net/netns/core.h
> > @@ -23,6 +23,7 @@ struct netns_core {
> >  #if IS_ENABLED(CONFIG_RPS) && IS_ENABLED(CONFIG_SYSCTL)
> >       struct cpumask *rps_default_mask;
> >  #endif
> > +     int     sysctl_tstamp_allow_data;
> >  };
> >
> >  #endif
> > diff --git a/include/net/sock.h b/include/net/sock.h
> > index c58ca8dd561b..4f31be0fd671 100644
> > --- a/include/net/sock.h
> > +++ b/include/net/sock.h
> > @@ -2808,8 +2808,6 @@ void sk_get_meminfo(const struct sock *sk, u32 *meminfo);
> >  extern __u32 sysctl_wmem_max;
> >  extern __u32 sysctl_rmem_max;
> >
> > -extern int sysctl_tstamp_allow_data;
> > -
> >  extern __u32 sysctl_wmem_default;
> >  extern __u32 sysctl_rmem_default;
> >
> > diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
> > index e39479f1c9a4..e78c01912c64 100644
> > --- a/net/core/net_namespace.c
> > +++ b/net/core/net_namespace.c
> > @@ -317,6 +317,7 @@ static __net_init void preinit_net_sysctl(struct net *net)
> >        */
> >       net->core.sysctl_optmem_max = 128 * 1024;
> >       net->core.sysctl_txrehash = SOCK_TXREHASH_ENABLED;
> > +     net->core.sysctl_tstamp_allow_data = 1;
> >  }
> >
> >  /* init code that must occur even if setup_net() is not called. */
> > diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> > index 74149dc4ee31..ad727d924f73 100644
> > --- a/net/core/skbuff.c
> > +++ b/net/core/skbuff.c
> > @@ -5506,7 +5506,7 @@ static bool skb_may_tx_timestamp(struct sock *sk, bool tsonly)
> >  {
> >       bool ret;
> >
> > -     if (likely(READ_ONCE(sysctl_tstamp_allow_data) || tsonly))
> > +     if (likely(READ_ONCE(sock_net(sk)->core.sysctl_tstamp_allow_data) || tsonly))
> >               return true;
>
> Let's switch order of the tests here too

Got it. Will do it.

Thanks,
Jason

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ