netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Paolo Abeni <pabeni@redhat.com>
Cc: jbaron@akamai.com, davem@davemloft.net, edumazet@google.com,
	horms@kernel.org, kuniyu@google.com, netdev@vger.kernel.org,
	Kuniyuki Iwashima <kuni1840@gmail.com>
Subject: Re: [PATCH net-next v2 3/3] netlink: Fix wraparound of sk->sk_rmem_alloc
Date: Tue, 24 Jun 2025 07:11:57 -0700	[thread overview]
Message-ID: <20250624071157.3cbb1265@kernel.org> (raw)
In-Reply-To: <93633df1-fa0c-49d8-b7e9-32ca2761e63f@redhat.com>

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?

  parent reply	other threads:[~2025-06-24 14:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-18 23:13 [PATCH net-next v2 0/3] Fix netlink rcvbuf wraparound Jason Baron
2025-06-18 23:13 ` [PATCH net-next v2 1/3] net: add sock_rcvbuf_has_space() helper Jason Baron
2025-06-18 23:13 ` [PATCH net-next v2 2/3] udp: use __sock_rcvbuf_has_space() helper Jason Baron
2025-06-18 23:13 ` [PATCH net-next v2 3/3] netlink: Fix wraparound of sk->sk_rmem_alloc Jason Baron
2025-06-19  6:13   ` Kuniyuki Iwashima
2025-06-23 23:35     ` Jakub Kicinski
2025-06-24  7:55       ` Paolo Abeni
2025-06-24 13:57         ` Jason Baron
2025-06-24 14:11         ` Jakub Kicinski [this message]
2025-06-24 17:08           ` Kuniyuki Iwashima
2025-06-24 22:03             ` Jakub Kicinski
2025-06-25 16:56               ` Kuniyuki Iwashima

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=20250624071157.3cbb1265@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jbaron@akamai.com \
    --cc=kuni1840@gmail.com \
    --cc=kuniyu@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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;
as well as URLs for NNTP newsgroup(s).