Re: [RFC PATCH v1 04/21] RISC-V: ACPI: Enhance acpi_os_ioremap with MMIO remapping

From: Andy Shevchenko
Date: Fri Aug 04 2023 - 01:48:15 EST


On Thu, Aug 03, 2023 at 11:28:59PM +0530, Sunil V L wrote:
> Enhance the acpi_os_ioremap() to support opregions in MMIO
> space. Also, have strict checks using EFI memory map
> to allow remapping the RAM similar to arm64.
>
> Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>
> Cc: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>

You may use --cc to the command line when forming patches.

Also we usually consider Cc: as a part of the tag block, meaning no blank line
should be here.

> Signed-off-by: Sunil V L <sunilvl@xxxxxxxxxxxxxxxx>

...

> #include <linux/io.h>
> #include <linux/pci.h>
> #include <linux/efi.h>
> +#include <linux/memblock.h>

Can you squeeze it to have some order, like to be after io.h (taking into
account given context)?

...

> + if (memblock_is_map_memory(phys) ||
> + !memblock_is_region_memory(phys, size)) {
> + pr_warn(FW_BUG "requested region covers kernel memory @ %p\n",
> + &phys);

How %p can be useful here (it's mangled), but also wouldn't this give a hint to
an attacker about the kernel memory location and diminish the KASLR protection?
(IIRC after boot we always have the same salt for the mangling the pointers when
printing, so at least theoretically it might be possible to bruteforce the
printing algo to give a clue about the kernel address.)

> + return NULL;
> + }

--
With Best Regards,
Andy Shevchenko