Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1586335

RE: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t

From "Reshetova, Elena" <elena.reshetova@intel.com>
Newsgroups linux.kernel
Subject RE: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t
Date 2017-02-22 18:30 +0100
Message-ID <tdITL-57Y-9@gated-at.bofh.it> (permalink)
References <tdkRr-4uK-11@gated-at.bofh.it> <tdkRr-4uK-13@gated-at.bofh.it> <tdHO2-4nL-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


> Elena Reshetova <elena.reshetova@intel.com> wrote:
> 
> > refcount_t type and corresponding API should be
> > used instead of atomic_t when the variable is used as
> > a reference counter. This allows to avoid accidental
> > refcounter overflows that might lead to use-after-free
> > situations.
> 
> This causes an assertion failure because cells aren't immediately destroyed
> when their refcount reaches 0, but may be resurrected provided the cache lock
> is held.  However, attempting to increment the 0 refcount does nothing, not
> even giving a warning.

This is strange, it is supposed to give a warning I think now when it is even not inlined. 
Peter, am I confusing smth?

> 
> So please place a hold on this patch.  I will check the other AFS patches also.
> 

Thank you very much David for testing the patches! 
I guess for this one and other two patches it means that if we want to do the atomic_t --> refcount_t conversions, 
we need to do +1 on the whole counting scheme to avoid issues around reaching zero.  
Do you see this approach reasonable? I can give it a try, if it makes sense in your opinion. 

Best Regards,
Elena.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t Elena Reshetova <elena.reshetova@intel.com> - 2017-02-21 16:50 +0100
  Re: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t David Howells <dhowells@redhat.com> - 2017-02-22 17:20 +0100
    RE: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to  refcount_t "Reshetova, Elena" <elena.reshetova@intel.com> - 2017-02-22 18:30 +0100
      Re: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t Kees Cook <keescook@chromium.org> - 2017-02-22 18:40 +0100
        RE: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to  refcount_t "Reshetova, Elena" <elena.reshetova@intel.com> - 2017-02-23 14:40 +0100
        Re: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t David Howells <dhowells@redhat.com> - 2017-02-24 15:30 +0100
      Re: [PATCH 1/4] fs, afs: convert afs_cell.usage from atomic_t to refcount_t David Howells <dhowells@redhat.com> - 2017-02-22 18:40 +0100

csiph-web