Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-29 Thread Kees Cook
On Wed, Jul 24, 2019 at 06:55:47PM +0200, Jann Horn wrote: > (Accurate) statistics counters need RMW ops, don't need memory > ordering, usually can't be locked against writes, and may not care > about wrapping. > This thing doesn't need RMW ops, does need memory ordering, can be > locked against

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-24 Thread Jann Horn
On Wed, Jul 24, 2019 at 5:54 PM Kees Cook wrote: > On Wed, Jul 24, 2019 at 04:28:31PM +0200, Jann Horn wrote: > > On Wed, Jul 24, 2019 at 12:17 AM Kees Cook wrote: > > > Perhaps we need a "statistics" counter type for these kinds of counters? > > > "counter_t"? I bet there are a lot of atomic_t

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-24 Thread Ondrej Mosnacek
On Tue, Jul 23, 2019 at 4:54 PM Jann Horn wrote: > On Mon, Jul 22, 2019 at 3:44 PM Ondrej Mosnacek wrote: > > On Mon, Jul 22, 2019 at 1:35 PM NitinGote wrote: > > > refcount_t type and corresponding API should be > > > used instead of atomic_t when the variable is used as > > > a reference

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-24 Thread Kees Cook
On Wed, Jul 24, 2019 at 04:28:31PM +0200, Jann Horn wrote: > On Wed, Jul 24, 2019 at 12:17 AM Kees Cook wrote: > > Perhaps we need a "statistics" counter type for these kinds of counters? > > "counter_t"? I bet there are a lot of atomic_t uses that are just trying > > to be counters. (likely most

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-24 Thread Jann Horn
On Wed, Jul 24, 2019 at 12:17 AM Kees Cook wrote: > On Tue, Jul 23, 2019 at 04:53:47PM +0200, Jann Horn wrote: > > On Mon, Jul 22, 2019 at 3:44 PM Ondrej Mosnacek wrote: > > > On Mon, Jul 22, 2019 at 1:35 PM NitinGote wrote: > > > > refcount_t type and corresponding API should be > > > > used

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-23 Thread Kees Cook
On Tue, Jul 23, 2019 at 04:53:47PM +0200, Jann Horn wrote: > On Mon, Jul 22, 2019 at 3:44 PM Ondrej Mosnacek wrote: > > On Mon, Jul 22, 2019 at 1:35 PM NitinGote wrote: > > > refcount_t type and corresponding API should be > > > used instead of atomic_t when the variable is used as > > > a

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-23 Thread Jann Horn
On Mon, Jul 22, 2019 at 3:44 PM Ondrej Mosnacek wrote: > On Mon, Jul 22, 2019 at 1:35 PM NitinGote 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

RE: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-22 Thread Gote, Nitin R
kernel mailing list ker...@vger.kernel.org> > Subject: Re: [PATCH] selinux: convert struct sidtab count to refcount_t > > On Mon, Jul 22, 2019 at 1:35 PM NitinGote wrote: > > refcount_t type and corresponding API should be used instead of > > atomic_t when the vari

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-22 Thread Paul Moore
On Mon, Jul 22, 2019 at 9:18 AM Ondrej Mosnacek wrote: > On Mon, Jul 22, 2019 at 1:35 PM NitinGote 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

Re: [PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-22 Thread Ondrej Mosnacek
On Mon, Jul 22, 2019 at 1:35 PM NitinGote 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. > >

[PATCH] selinux: convert struct sidtab count to refcount_t

2019-07-22 Thread NitinGote
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. Signed-off-by: NitinGote --- security/selinux/ss/sidtab.c | 16