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:   Sat, 16 Jan 2021 08:30:21 +0800
From:   Nicolas Boichat <drinkcat@...omium.org>
To:     Rob Herring <robh@...nel.org>
Cc:     Quentin Perret <qperret@...gle.com>,
        Rob Herring <robh+dt@...nel.org>,
        Devicetree List <devicetree@...r.kernel.org>,
        Florian Fainelli <f.fainelli@...il.com>,
        Stephen Boyd <swboyd@...omium.org>,
        KarimAllah Ahmed <karahmed@...zon.de>, kernel-team@...roid.com,
        Frank Rowand <frowand.list@...il.com>,
        lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] of/fdt: Make sure no-map does not remove already
 reserved regions

On Sat, Jan 16, 2021 at 1:30 AM Rob Herring <robh@...nel.org> wrote:
>
> On Fri, 15 Jan 2021 11:45:44 +0000, Quentin Perret wrote:
> > From: Nicolas Boichat <drinkcat@...omium.org>
> >
> > If the device tree is incorrectly configured, and attempts to
> > define a "no-map" reserved memory that overlaps with the kernel
> > data/code, the kernel would crash quickly after boot, with no
> > obvious clue about the nature of the issue.
> >
> > For example, this would happen if we have the kernel mapped at
> > these addresses (from /proc/iomem):
> > 40000000-41ffffff : System RAM
> >   40080000-40dfffff : Kernel code
> >   40e00000-411fffff : reserved
> >   41200000-413e0fff : Kernel data
> >
> > And we declare a no-map shared-dma-pool region at a fixed address
> > within that range:
> > mem_reserved: mem_region {
> >       compatible = "shared-dma-pool";
> >       reg = <0 0x40000000 0 0x01A00000>;
> >       no-map;
> > };
> >
> > To fix this, when removing memory regions at early boot (which is
> > what "no-map" regions do), we need to make sure that the memory
> > is not already reserved. If we do, __reserved_mem_reserve_reg
> > will throw an error:
> > [    0.000000] OF: fdt: Reserved memory: failed to reserve memory
> >    for node 'mem_region': base 0x0000000040000000, size 26 MiB
> > and the code that will try to use the region should also fail,
> > later on.
> >
> > We do not do anything for non-"no-map" regions, as memblock
> > explicitly allows reserved regions to overlap, and the commit
> > that this fixes removed the check for that precise reason.
> >
> > [ qperret: fixed conflicts caused by the usage of memblock_mark_nomap ]
> >
> > Fixes: 094cb98179f19b7 ("of/fdt: memblock_reserve /memreserve/ regions in the case of partial overlap")
> > Signed-off-by: Nicolas Boichat <drinkcat@...omium.org>
> > Reviewed-by: Stephen Boyd <swboyd@...omium.org>
> > Signed-off-by: Quentin Perret <qperret@...gle.com>
> > ---
> >  drivers/of/fdt.c | 10 +++++++++-
> >  1 file changed, 9 insertions(+), 1 deletion(-)
> >

Thanks for picking up this old patch Quentin ,-)

> Applied, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ