|
Message-ID: <CAHC9VhSpwafSdcX97VPiy1Earns4UOBjywcM9R=j24KFUtWB8g@mail.gmail.com> Date: Mon, 22 Jul 2019 20:36:06 -0400 From: Paul Moore <paul@...l-moore.com> To: Kees Cook <keescook@...omium.org> Cc: Ondrej Mosnacek <omosnace@...hat.com>, selinux@...r.kernel.org, NitinGote <nitin.r.gote@...el.com>, kernel-hardening@...ts.openwall.com, linux-security-module@...r.kernel.org Subject: Re: [PATCH] selinux: check sidtab limit before adding a new entry On Mon, Jul 22, 2019 at 12:50 PM Kees Cook <keescook@...omium.org> wrote: > On Mon, Jul 22, 2019 at 03:21:11PM +0200, Ondrej Mosnacek wrote: > > We need to error out when trying to add an entry above SIDTAB_MAX in > > sidtab_reverse_lookup() to avoid overflow on the odd chance that this > > happens. > > > > Fixes: ee1a84fdfeed ("selinux: overhaul sidtab to fix bug and improve performance") > > Signed-off-by: Ondrej Mosnacek <omosnace@...hat.com> > > Is this reachable from unprivileged userspace? I believe it's reachable via selinuxfs under /sys/fs/selinux/context, and the DAC permissions are for the relevant files are 0666, but the SELinux policy might restrict that. > > --- > > security/selinux/ss/sidtab.c | 5 +++++ > > 1 file changed, 5 insertions(+) > > > > diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c > > index e63a90ff2728..54c1ba1e79ab 100644 > > --- a/security/selinux/ss/sidtab.c > > +++ b/security/selinux/ss/sidtab.c > > @@ -286,6 +286,11 @@ static int sidtab_reverse_lookup(struct sidtab *s, struct context *context, > > ++count; > > } > > > > + /* bail out if we already reached max entries */ > > + rc = -ENOMEM; > > + if (count == SIDTAB_MAX) > > Do you want to use >= here instead? Yes, definitely. -- 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.