From: Kees Cook <kees@kernel.org>
To: Kent Overstreet <kent.overstreet@linux.dev>
Cc: linux-bcachefs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-hardening@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 0/3] enumarated refcounts, for debugging refcount issues
Date: Sun, 20 Apr 2025 20:09:50 -0700 [thread overview]
Message-ID: <202504202008.533326EF4@keescook> (raw)
In-Reply-To: <yd3f6ie56x2dbagqycwluxtz7inrmbub5fg7omp226vrdvxtb2@sjn23uj3r6t7>
On Sun, Apr 20, 2025 at 09:27:26PM -0400, Kent Overstreet wrote:
> On Sun, Apr 20, 2025 at 06:08:41PM -0700, Kees Cook wrote:
> > On Sun, Apr 20, 2025 at 11:59:13AM -0400, Kent Overstreet wrote:
> > > Not sure we have a list for library code, but this might be of interest
> > > to anyone who's had to debug refcount issues on refs with lots of users
> > > (filesystem people), and I know the hardening folks deal with refcounts
> > > a lot.
> >
> > Why not use refcount_t instead of atomic_t?
>
> It's rather pointless here since percpu refcounts don't (and can't)
> support saturation, and atomic_long_t should always suffice - you'd have
> to be doing something particularly bizarre for it not to, since
> refcounts generally count things in memory.
Ah yes, my eyes skipped over the "long" part when I was reading the
patches. There's currently no sane reason to use refcount_t when
already using atomic_long_t. Sorry for the noise!
> Out of curiousity, has overflow of an atomic_long_t refcount ever been
> observed?
Not to my knowledge. :)
--
Kees Cook
next prev parent reply other threads:[~2025-04-21 3:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-20 15:59 [PATCH 0/3] enumarated refcounts, for debugging refcount issues Kent Overstreet
2025-04-20 15:59 ` [PATCH 1/3] bcachefs: enumerated_ref.c Kent Overstreet
2025-04-20 15:59 ` [PATCH 2/3] bcachefs: bch_fs.writes -> enumerated_refs Kent Overstreet
2025-04-20 15:59 ` [PATCH 3/3] bcachefs: bch_dev.io_ref -> enumerated_ref Kent Overstreet
2025-04-21 1:08 ` [PATCH 0/3] enumarated refcounts, for debugging refcount issues Kees Cook
2025-04-21 1:27 ` Kent Overstreet
2025-04-21 3:09 ` Kees Cook [this message]
2025-04-23 21:35 ` Kane York
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=202504202008.533326EF4@keescook \
--to=kees@kernel.org \
--cc=kent.overstreet@linux.dev \
--cc=linux-bcachefs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.