Re: [PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-29 Thread Andrea Parri
On Mon, Jun 24, 2019 at 02:45:34PM -0400, Joel Fernandes (Google) wrote: > struct pid's count is an atomic_t field used as a refcount. Use > refcount_t for it which is basically atomic_t but does additional > checking to prevent use-after-free bugs. > > For memory ordering, the only change is

Re: [PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-26 Thread Joel Fernandes
On Tue, Jun 25, 2019 at 09:34:07AM +0200, Peter Zijlstra wrote: > On Mon, Jun 24, 2019 at 09:10:15PM +0200, Jann Horn wrote: > > That part of the documentation only talks about cases where you have a > > control dependency on the return value of the refcount operation. But > > refcount_inc() does

Re: [PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-25 Thread Peter Zijlstra
On Mon, Jun 24, 2019 at 09:10:15PM +0200, Jann Horn wrote: > That part of the documentation only talks about cases where you have a > control dependency on the return value of the refcount operation. But > refcount_inc() does not return a value, so this isn't relevant for > refcount_inc(). > >

Re: [PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-24 Thread Joel Fernandes
On Mon, Jun 24, 2019 at 3:10 PM Jann Horn wrote: > > On Mon, Jun 24, 2019 at 8:52 PM Joel Fernandes wrote: > > On Mon, Jun 24, 2019 at 02:45:34PM -0400, Joel Fernandes (Google) wrote: > > > struct pid's count is an atomic_t field used as a refcount. Use > > > refcount_t for it which is basically

Re: [PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-24 Thread Jann Horn
On Mon, Jun 24, 2019 at 8:52 PM Joel Fernandes wrote: > On Mon, Jun 24, 2019 at 02:45:34PM -0400, Joel Fernandes (Google) wrote: > > struct pid's count is an atomic_t field used as a refcount. Use > > refcount_t for it which is basically atomic_t but does additional > > checking to prevent

Re: [PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-24 Thread Joel Fernandes
On Mon, Jun 24, 2019 at 02:45:34PM -0400, Joel Fernandes (Google) wrote: > struct pid's count is an atomic_t field used as a refcount. Use > refcount_t for it which is basically atomic_t but does additional > checking to prevent use-after-free bugs. > > For memory ordering, the only change is

[PATCH RFC v2] Convert struct pid count to refcount_t

2019-06-24 Thread Joel Fernandes (Google)
struct pid's count is an atomic_t field used as a refcount. Use refcount_t for it which is basically atomic_t but does additional checking to prevent use-after-free bugs. For memory ordering, the only change is with the following: - if ((atomic_read(>count) == 1) || -