Re: [PATCH] lkdtm: Add more EFI runtime tests

From: MaeeFilho FL

Date: Sun Oct 11 2026 - 12:06:32 EST


Hi Ard,

The Code is excellent. A few points worth highlighting:

> Two bugs were found in the arm64 EFI runtime support that weren't caught
> by LKDTM. The existing EFI_RUNTIME_CRASH test instructs the firmware to
> write to kernel memory that is mapped read-only, which usually fails as
> expected. However, this does not exercise the runtime mapping logic in
> the kernel, nor the fault recovery logic when the faulting address is
> inside the EFI runtime memory regions itself.
>
> So add two more test cases:
> - a write to R/O memory test that uses the firmware's own executable
> memory as an output buffer
> - a branch to memory that is occupied by the firmware's runtime services
> function table, which is usually mapped non-execute.

This is an excellent addition to the LKDTM suite. Forcing GetTime() to
target efi.runtime->set_time is a very clever way to ensure that the
firmware page tables are strictly enforcing permissions over its own
executable boundaries, rather than just testing general kernel mappings.

The execution tracking via the anonymous function pointer struct conversion
to trap NX faults on efi.runtime data object is also rock solid and properly
exercises the arm64 translation tables validation logic.

Reviewed-by: João Guilherme da Silva Freitas Lima <joaoanandalima@xxxxxxxxx>