kernel-hardening.lists.openwall.com archive mirror
 help / color / mirror / Atom feed
From: Paul Moore <paul@paul-moore.com>
To: Ondrej Mosnacek <omosnace@redhat.com>
Cc: selinux@vger.kernel.org, NitinGote <nitin.r.gote@intel.com>,
	 kernel-hardening@lists.openwall.com,
	Kees Cook <keescook@chromium.org>,
	 William Roberts <bill.c.roberts@gmail.com>
Subject: Re: [PATCH v2] selinux: check sidtab limit before adding a new entry
Date: Wed, 24 Jul 2019 11:18:41 -0400	[thread overview]
Message-ID: <CAHC9VhSmcGoaDzOp7xbwvh2pYusMS-ReBC5Nrqi5eZYCuZpR7g@mail.gmail.com> (raw)
In-Reply-To: <20190723065059.30101-1-omosnace@redhat.com>

On Tue, Jul 23, 2019 at 2:51 AM Ondrej Mosnacek <omosnace@redhat.com> 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@redhat.com>
> ---
>  security/selinux/ss/sidtab.c | 5 +++++
>  1 file changed, 5 insertions(+)

Thanks.  This looks like -stable material to me so I've marked it as
such and merged it into selinux/stable-5.3; assuming it passes
testing, and as long as I don't hear any objections, I'll send it up
to Linus later this week.

> diff --git a/security/selinux/ss/sidtab.c b/security/selinux/ss/sidtab.c
> index e63a90ff2728..1f0a6eaa2d6a 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 = -EOVERFLOW;
> +       if (count >= SIDTAB_MAX)
> +               goto out_unlock;
> +
>         /* insert context into new entry */
>         rc = -ENOMEM;
>         dst = sidtab_do_lookup(s, count, 1);
> --
> 2.21.0

-- 
paul moore
www.paul-moore.com

      parent reply	other threads:[~2019-07-24 15:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-23  6:50 [PATCH v2] selinux: check sidtab limit before adding a new entry Ondrej Mosnacek
2019-07-23 22:15 ` Kees Cook
2019-07-24 15:18 ` Paul Moore [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHC9VhSmcGoaDzOp7xbwvh2pYusMS-ReBC5Nrqi5eZYCuZpR7g@mail.gmail.com \
    --to=paul@paul-moore.com \
    --cc=bill.c.roberts@gmail.com \
    --cc=keescook@chromium.org \
    --cc=kernel-hardening@lists.openwall.com \
    --cc=nitin.r.gote@intel.com \
    --cc=omosnace@redhat.com \
    --cc=selinux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).