lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAFftDdoCmXCZwfr52wry+3eCZHiBAfHg_PQyLC-s-r3tEZw09g@mail.gmail.com>
Date:   Thu, 30 May 2019 08:16:36 -0700
From:   William Roberts <bill.c.roberts@...il.com>
To:     Ondrej Mosnacek <omosnace@...hat.com>
Cc:     Gen Zhang <blackgod016574@...il.com>,
        Paul Moore <paul@...l-moore.com>, tony.luck@...el.com,
        Stephen Smalley <sds@...ho.nsa.gov>,
        Eric Paris <eparis@...isplace.org>, selinux@...r.kernel.org,
        Linux kernel mailing list <linux-kernel@...r.kernel.org>,
        bpf@...r.kernel.org
Subject: Re: [PATCH v2] hooks: fix a missing-check bug in selinux_sb_eat_lsm_opts()

On Thu, May 30, 2019 at 4:52 AM Ondrej Mosnacek <omosnace@...hat.com> wrote:
>
> On Thu, May 30, 2019 at 10:51 AM Gen Zhang <blackgod016574@...il.com> wrote:
> > In selinux_sb_eat_lsm_opts(), 'arg' is allocated by kmemdup_nul(). It
> > returns NULL when fails. So 'arg' should be checked.
> >
> > Signed-off-by: Gen Zhang <blackgod016574@...il.com>
> > Fixes: 99dbbb593fe6 ("selinux: rewrite selinux_sb_eat_lsm_opts()")
> > ---
> > diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
> > index 3ec702c..5a9e959 100644
> > --- a/security/selinux/hooks.c
> > +++ b/security/selinux/hooks.c
> > @@ -2635,6 +2635,8 @@ static int selinux_sb_eat_lsm_opts(char *options, void **mnt_opts)
> >                                                 *q++ = c;
> >                                 }
> >                                 arg = kmemdup_nul(arg, q - arg, GFP_KERNEL);
> > +                               if (!arg)
> > +                                       return -ENOMEM;

Yeah -ENOMEM is correct here. Ack by me.

> >                         }
> >                         rc = selinux_add_opt(token, arg, mnt_opts);
> >                         if (unlikely(rc)) {
>
> Looking at the callers of security_sb_eat_lsm_opts() (which is the
> function that eventually calls the selinux_sb_eat_lsm_opts() hook),
> -ENOMEM should be appropriate here.
>
> Reviewed-by: Ondrej Mosnacek <omosnace@...hat.com>
>
> --
> Ondrej Mosnacek <omosnace at redhat dot com>
> Software Engineer, Security Technologies
> Red Hat, Inc.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ