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: <CAL_JsqJZWmy8PGwjjBc7FA2JcgvHqmtgkkuHy=XHMT8bVEAxSA@mail.gmail.com>
Date:   Mon, 10 Apr 2023 07:52:36 -0500
From:   Rob Herring <robh+dt@...nel.org>
To:     Lucas Tanure <tanure@...ux.com>
Cc:     Frank Rowand <frowand.list@...il.com>,
        Mike Rapoport <rppt@...nel.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-mm@...ck.org, jbrunet@...libre.com,
        linux-amlogic@...ts.infradead.org,
        linux-arm-kernel@...ts.infradead.org,
        martin.blumenstingl@...glemail.com, narmstrong@...libre.com,
        stefan@...er.ch
Subject: Re: [PATCH v2 1/1] of: fdt: Scan /memreserve/ last

On Mon, Apr 10, 2023 at 7:00 AM Lucas Tanure <tanure@...ux.com> wrote:
>
> Change the order of scanning /memreserve/ and /reserved-memory node.
> /reserved-memory node should go first, as it has a more updated
> description of the memory regions and it can apply flags, like nomap.
> Also, /memreserve/ should avoid reserving regions described in
> /reserved-memory node.

Like I said on v1, I think doing this has a high chance of causing
regressions on other platforms. It should probably not go to stable
for some time after a kernel release.

> Signed-off-by: Lucas Tanure <tanure@...ux.com>
> ---
>  drivers/of/fdt.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
> index d1a68b6d03b3..26e608d8025d 100644
> --- a/drivers/of/fdt.c
> +++ b/drivers/of/fdt.c
> @@ -635,16 +635,21 @@ void __init early_init_fdt_scan_reserved_mem(void)
>         if (!initial_boot_params)
>                 return;
>
> +       fdt_scan_reserved_mem();
> +       fdt_reserve_elfcorehdr();
> +
>         /* Process header /memreserve/ fields */
>         for (n = 0; ; n++) {
>                 fdt_get_mem_rsv(initial_boot_params, n, &base, &size);
>                 if (!size)
>                         break;
> +               if (memblock_overlaps_region(&memblock.memory, base, size) &&
> +                   memblock_is_region_reserved(base, size))

Just to make sure, a partial overlap will still get reserved?

> +                       break;

Shouldn't we continue to the next entry rather than stopping.

> +
>                 memblock_reserve(base, size);
>         }
>
> -       fdt_scan_reserved_mem();
> -       fdt_reserve_elfcorehdr();
>         fdt_init_reserved_mem();
>  }
>
> --
> 2.40.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ