|
Message-ID: <CAHC9VhSQLkRSby3-9PGZZrLMGB4Fe8ZZjupHRm0nVxco85A1fQ@mail.gmail.com> Date: Mon, 22 Jul 2019 20:25:18 -0400 From: Paul Moore <paul@...l-moore.com> To: Ondrej Mosnacek <omosnace@...hat.com>, NitinGote <nitin.r.gote@...el.com> Cc: Kees Cook <keescook@...omium.org>, kernel-hardening@...ts.openwall.com, Stephen Smalley <sds@...ho.nsa.gov>, Eric Paris <eparis@...isplace.org>, SElinux list <selinux@...r.kernel.org>, Linux kernel mailing list <linux-kernel@...r.kernel.org> Subject: Re: [PATCH] selinux: convert struct sidtab count to refcount_t On Mon, Jul 22, 2019 at 9:18 AM Ondrej Mosnacek <omosnace@...hat.com> wrote: > On Mon, Jul 22, 2019 at 1:35 PM NitinGote <nitin.r.gote@...el.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. > > > > Signed-off-by: NitinGote <nitin.r.gote@...el.com> > > Nack. > > The 'count' variable is not used as a reference counter here. It > tracks the number of entries in sidtab, which is a very specific > lookup table that can only grow (the count never decreases). I only > made it atomic because the variable is read outside of the sidtab's > spin lock and thus the reads and writes to it need to be guaranteed to > be atomic. The counter is only updated under the spin lock, so > insertions do not race with each other. Agreed, this should be changed to use refcount_t. -- paul moore www.paul-moore.com
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.