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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPcyv4if2YwyYSn9XLKHQXX2oe+nX2idvNx79M2s1j4FMftkBg@mail.gmail.com>
Date:   Tue, 8 Jan 2019 16:46:17 -0800
From:   Dan Williams <dan.j.williams@...el.com>
To:     Kees Cook <keescook@...omium.org>
Cc:     Dave Jiang <dave.jiang@...el.com>,
        linux-nvdimm <linux-nvdimm@...ts.01.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: nvdimm crash at boot

On Tue, Jan 8, 2019 at 4:02 PM Dan Williams <dan.j.williams@...el.com> wrote:
>
> On Tue, Jan 8, 2019 at 3:55 PM Kees Cook <keescook@...omium.org> wrote:
> >
> > On Tue, Jan 8, 2019 at 3:54 PM Dan Williams <dan.j.williams@...el.com> wrote:
> > >
> > > On Tue, Jan 8, 2019 at 3:34 PM Kees Cook <keescook@...omium.org> wrote:
> > > >
> > > > On Tue, Jan 8, 2019 at 3:28 PM Dan Williams <dan.j.williams@...el.com> wrote:
> > > > > Ah, thanks for the report! The key difference is that you don't define
> > > > > a "label area", so the driver bails out early and never initializes
> > > > > the security state.
> > > > >
> > > > > This should fix it up.
> > > > >
> > > > > diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c
> > > > > index 4890310df874..636cdb06ee17 100644
> > > > > --- a/drivers/nvdimm/dimm_devs.c
> > > > > +++ b/drivers/nvdimm/dimm_devs.c
> > > > > @@ -514,7 +514,7 @@ static umode_t nvdimm_visible(struct kobject
> > > > > *kobj, struct attribute *a, int n)
> > > > >
> > > > >         if (a != &dev_attr_security.attr)
> > > > >                 return a->mode;
> > > > > -       if (nvdimm->sec.state < 0)
> > > > > +       if (!nvdimm->sec.ops || nvdimm->sec.state < 0)
> > > > >                 return 0;
> > > > >         /* Are there any state mutation ops? */
> > > > >         if (nvdimm->sec.ops->freeze || nvdimm->sec.ops->disable
> > > >
> > > > Okay, cool. I wasn't sure if that test needed a deeper check. :)
> > > >
> > > > Fixes: 37833fb7989a9 ("acpi/nfit, libnvdimm: Add freeze security
> > > > support to Intel nvdimm")
> > > > Tested-by: Kees Cook <keescook@...omium.org>
> > > >
> > >
> > > Actually, looking closer this should have been avoided by the fact
> > > that __nvdimm_create() initializes the security state early and that
> > > nvdimm->sec.state should have saved us.
> > >
> > > I'll dig a bit deeper with your qemu config.
> >
> > Maybe something goes weird with pstore stealing the region?
>
> No, pstore is off the hook. I was just able to reproduce locally and
> I'm not doing anything with pstore.

Huh, this fixes it:

diff --git a/include/linux/libnvdimm.h b/include/linux/libnvdimm.h
index 5440f11b0907..7315977b64da 100644
--- a/include/linux/libnvdimm.h
+++ b/include/linux/libnvdimm.h
@@ -160,6 +160,7 @@ static inline struct nd_blk_region_desc *to_blk_region_desc(
 }

 enum nvdimm_security_state {
+       NVDIMM_SECURITY_ERROR = -1,
        NVDIMM_SECURITY_DISABLED,
        NVDIMM_SECURITY_UNLOCKED,
        NVDIMM_SECURITY_LOCKED,

Apparently I was wrong to think an enum was a signed int without
actually making a signed value a possibility. I would have a expected
the compiler to give me a "statement has no effect" for testing for a
negative value against an effectively unsigned quantity.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ