Re: [RESEND PATCH v4 03/10] lib/refcount: Remove unused refcount_*_checked() variants

From: Kees Cook
Date: Thu Nov 21 2019 - 12:12:03 EST


On Thu, Nov 21, 2019 at 03:55:33PM +0100, David Sterba wrote:
> On Thu, Nov 21, 2019 at 11:58:55AM +0000, Will Deacon wrote:
> > The full-fat refcount implementation is exposed via a set of functions
> > suffixed with "_checked()", the idea being that code can choose to use
> > the more expensive, yet more secure implementation on a case-by-case
> > basis.
> >
> > In reality, this hasn't happened, so with a grand total of zero users,
> > let's remove the checked variants for now by simply dropping the suffix
> > and predicating the out-of-line functions on CONFIG_REFCOUNT_FULL=y.
>
> I am still interested in the _checked versions and have a WIP patch that
> adds that to btrfs (that was my original plan) but haven't had enough
> time to finalize it. The patch itself is simple, the missing part is to
> understand and document what the saturated counters would do with the
> structures.

The good news is that this series removes the case of refcount_t _not_
being checked, so there's no need for _checked helpers.
CONFIG_REFCOUNT_FULL gets removed because all refcount_t ends up being
checked on all architectures. No extra work needed! :) (See patch 8)

--
Kees Cook