netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Daniel Borkmann <daniel@iogearbox.net>, netdev@vger.kernel.org
Cc: "The UK's National Cyber Security Centre (NCSC)"
	<security@ncsc.gov.uk>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	stable@kernel.org
Subject: Re: [PATCH net v2] packet: Move reference count in packet_sock to atomic_long_t
Date: Fri, 1 Dec 2023 16:12:10 +0100	[thread overview]
Message-ID: <93e09c53-0621-4cdf-9e5f-84e8d20585a3@gmail.com> (raw)
In-Reply-To: <20231201131021.19999-1-daniel@iogearbox.net>


On 12/1/23 14:10, Daniel Borkmann wrote:
> In some potential instances the reference count on struct packet_sock
> could be saturated and cause overflows which gets the kernel a bit
> confused. To prevent this, move to a 64-bit atomic reference count on
> 64-bit architectures to prevent the possibility of this type to overflow.
>
> Because we can not handle saturation, using refcount_t is not possible
> in this place. Maybe someday in the future if it changes it could be
> used. Also, instead of using plain atomic64_t, use atomic_long_t instead.
> 32-bit machines tend to be memory-limited (i.e. anything that increases
> a reference uses so much memory that you can't actually get to 2**32
> references). 32-bit architectures also tend to have serious problems
> with 64-bit atomics. Hence, atomic_long_t is the more natural solution.
>
> Reported-by: "The UK's National Cyber Security Centre (NCSC)" <security@ncsc.gov.uk>
> Co-developed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Cc: Linus Torvalds <torvalds@linux-foundation.org>
> Cc: stable@kernel.org
> ---
>   

Reviewed-by: Eric Dumazet <edumazet@google.com>



  parent reply	other threads:[~2023-12-01 15:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-01 13:10 [PATCH net v2] packet: Move reference count in packet_sock to atomic_long_t Daniel Borkmann
2023-12-01 15:03 ` Willem de Bruijn
2023-12-01 15:12 ` Eric Dumazet [this message]
2023-12-01 23:02 ` Greg Kroah-Hartman
2023-12-04 23:20 ` patchwork-bot+netdevbpf

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=93e09c53-0621-4cdf-9e5f-84e8d20585a3@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=daniel@iogearbox.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=netdev@vger.kernel.org \
    --cc=security@ncsc.gov.uk \
    --cc=stable@kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=willemdebruijn.kernel@gmail.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).