[PATCH v2] arm64: efi: Fix handling of misaligned runtime regions and drop warning

Linus Torvalds torvalds at linux-foundation.org
Sun Nov 6 11:38:29 PST 2022


[ Note: in quoting the patch below, I removed the '-' lines, so the
quoted part is really just all that remains after the patch ]

On Sun, Nov 6, 2022 at 6:54 AM Ard Biesheuvel <ardb at kernel.org> wrote:
>
> +       if (region_is_misaligned(md)) {
> +               static bool __initdata code_is_misaligned;
> +
>                 /*
> +                * Regions that are not aligned to the OS page size cannot be
> +                * mapped with strict permissions, as those might interfere
> +                * with the permissions that are needed by the adjacent
> +                * region's mapping. However, if we haven't encountered any
> +                * misaligned runtime code regions so far, we can safely use
> +                * non-executable permissions for non-code regions.
>                  */
> +               code_is_misaligned |= (type == EFI_RUNTIME_SERVICES_CODE);
> +
> +               return code_is_misaligned ? pgprot_val(PAGE_KERNEL_EXEC)
> +                                         : pgprot_val(PAGE_KERNEL);
> +       }

Ok, this seems like a nice improvement, in how it only does
PAGE_KERNEL_EXEC if any of the regions end up being code.

At the same time this is a much bigger change than just changing the
WARN_ONCE() to pr_warn_once(), so rather than me applying it directly
to my tree, I think I'd prefer it to go through the proper channels
and the usual way.

I'll still apply it to my private "this is the tree I actually boot on
my M2" testing tree, since that has all the other Asahi patches too.
That way I won't see the warning myself on that machine.

So "Acked-by" on the patch, and I hope I'll see it with a future arm64
or EFI pull request (and I'll holler loudly if it actually causes any
issues on my M2, but I obviously don't expect it to)

Thanks,
               Linus



More information about the linux-arm-kernel mailing list