lkml.org 
[lkml]   [2020]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 0/3] Convert nsproxy, groups, and creds to refcount_t
On Tue, Jul 21, 2020 at 11:44:53AM -0700, Kees Cook wrote:
> On Tue, Jul 21, 2020 at 11:51:04AM +0100, David Howells wrote:
> > Kees Cook <keescook@chromium.org> wrote:
> >
> > > > Should mm->mm_users also be replaced by refcount_t?
> > >
> > > I'll say "yes". :)
> > > https://lore.kernel.org/lkml/1487671124-11188-1-git-send-email-elena.reshetova@intel.com/
> > >
> > > > In addition, is it better to change all variables that use
> > > > atomic_dec_and_test to control the release process to refconut_t?
> > >
> > > For the most part, yes. The following may find a lot of them:
> > > scripts/coccinelle/api/atomic_as_refcounter.cocci
> >
> > I've been gradually undoing some of the conversions as there's no equivalent
> > of atomic_add_return() and atomic_dec_return() that allow me to log the
> > altered refcount through a tracepoint.
>
> Please do not _undo_ the changes; just add the API you need.

add_return and sub_return are horrible interface for refcount, which is
the problem.

If you meant: refcount_dec(), but want the old value for tracing, you
want a different ordering than if you wanted to do
refcount_dec_and_test(); dec_return can't know this.

David, would something like a __refcount_*() API work where there is a
3rd argument (int *), which, if !NULL, will be assigned the old value?

\
 
 \ /
  Last update: 2020-07-21 21:52    [W:0.287 / U:0.248 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site