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]
Date:   Fri, 15 Sep 2023 02:08:30 -0700
From:   Scott Branden <scott.branden@...adcom.com>
To:     Rafał Miłecki <rafal@...ecki.pl>
Cc:     Florian Fainelli <f.fainelli@...il.com>,
        Rafał Miłecki <zajec5@...il.com>,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
        linux-mtd@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Arınç ÜNAL <arinc.unal@...nc9.com>,
        Florian Fainelli <florian.fainelli@...adcom.com>
Subject: Re: [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content

On Fri, Sep 15, 2023 at 12:28 AM Rafał Miłecki <rafal@...ecki.pl> wrote:
>
> On 2023-09-14 23:30, Scott Branden wrote:
> > On Thu, Sep 14, 2023 at 2:26 PM Florian Fainelli <f.fainelli@...il.com>
> > wrote:
> >>
> >> On 9/13/23 23:49, Rafał Miłecki wrote:
> >> > From: Rafał Miłecki <rafal@...ecki.pl>
> >> >
> >> > This driver uses MMIO access for reading NVRAM from a flash device.
> >> > Underneath there is a flash controller that reads data and provides
> >> > mapping window.
> >> >
> >> > Using MMIO interface affects controller configuration and may break real
> >> > controller driver. It was reported by multiple users of devices with
> >> > NVRAM stored on NAND.
> >> >
> >> > Modify driver to read & cache all NVRAM content during init and use that
> >> > copy to provide NVMEM data when requested.
> >> >
> >> > Link: https://lore.kernel.org/linux-mtd/CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com/
> >> > Cc: Arınç ÜNAL <arinc.unal@...nc9.com>
> >> > Cc: Florian Fainelli <florian.fainelli@...adcom.com>
> >> > Cc: Scott Branden <scott.branden@...adcom.com>
> >> > Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
> >> > ---
> >> [snip]
> >> > -     priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> >> > -     if (IS_ERR(priv->base))
> >> > -             return PTR_ERR(priv->base);
> >> > +     base = devm_platform_get_and_ioremap_resource(pdev, 0, &res);
> >> > +     if (IS_ERR(base))
> >> > +             return PTR_ERR(base);
> >> > +
> >> > +     priv->size = resource_size(res);
> >> > +
> >> > +     priv->data = devm_kzalloc(dev, priv->size, GFP_KERNEL);
> >>
> >> These can conceivably quite big data structures, how about using
> >> kvmalloc()?
> > Why do we even need to expose MMIO interface to NAND though?  Why not
> > always go through the controller driver.  I don't see how the MMIO
> > access would be used given bad blocks aren't handled?
>
> We need to read NVMRAM *early* for booting purposes. Some vendors store
> there information about used firmware in case of having main one and
> fallback one. That info is required for partitioning which happens
> during mtd initialization before we have NAND driver fully initialized.
OK, it would have been nice for the bootloader to sort out and
retrieve any information.  But if you need to access flash in the
kernel before the nand driver is loaded so be it.  Thanks for the
explanation.
>
> --
> Rafał Miłecki

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4212 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ