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] [day] [month] [year] [list]
Message-ID: <CAAVpQUCxDGD-rd1-GaqrpeZCSSRi_U=CaRnGYCNM=MDoJqvM=g@mail.gmail.com>
Date: Wed, 25 Jun 2025 09:56:02 -0700
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Kuniyuki Iwashima <kuni1840@...il.com>, davem@...emloft.net, edumazet@...gle.com, 
	horms@...nel.org, jbaron@...mai.com, netdev@...r.kernel.org, 
	pabeni@...hat.com
Subject: Re: [PATCH net-next v2 3/3] netlink: Fix wraparound of sk->sk_rmem_alloc

On Tue, Jun 24, 2025 at 3:03 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> On Tue, 24 Jun 2025 10:08:41 -0700 Kuniyuki Iwashima wrote:
> > Date: Tue, 24 Jun 2025 07:11:57 -0700
> > From: Jakub Kicinski <kuba@...nel.org>
> > > On Tue, 24 Jun 2025 09:55:15 +0200 Paolo Abeni wrote:
> > > > > To be clear -- are you saying we should fix this differently?
> > > > > Or perhaps that the problem doesn't exist? The change doesn't
> > > > > seem very intrusive..
> > > >
> > > > AFAICS the race is possible even with netlink as netlink_unicast() runs
> > > > without the socket lock, too.
> > > >
> > > > The point is that for UDP the scenario with multiple threads enqueuing a
> > > > packet into the same socket is a critical path, optimizing for
> > > > performances and allowing some memory accounting inaccuracy makes sense.
> > > >
> > > > For netlink socket, that scenario looks a patological one and I think we
> > > > should prefer accuracy instead of optimization.
> > >
> > > Could you ELI5 what you mean? Are you suggesting a lock around every
> > > sk_rmem write for netlink sockets?
> > > If we think this is an attack vector the attacker can simply use a UDP
> > > socket instead. Or do you think it'd lead to simpler code?
> >
> > I was wondering if atomic_add_return() is expensive for netlink,
> > and if not, we could use it like below.
>
> Ah, got it. That does look simpler.
>
> nit: Please don't hide the atomic_add_return() in local variable init,
> as it need validation and error handling.

Makes sense.
Will post the official patch later.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ