Re: [PATCH v5 09/27] x86/boot: Remove mapping from page fault handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2023-03-14 23:33, Andy Lutomirski wrote:
On Tue, Mar 14, 2023, at 3:13 AM, Evgeniy Baskov wrote:
After every implicit mapping is removed, this code is no longer needed.

Remove memory mapping from page fault handler to ensure that there are
no hidden invalid memory accesses.

This patch is *by far* the scariest of the bunch in my boot.  And it
violates a basic principle of kernel development: it's better to run
in degraded mode than to fail outright unless running in degraded mode
is dangerous for some reason.

And this boot code is not actually meaningfully exposed to attack.
Anyone who can get the boot code to consume garbage likely *already*
controls the system, including anything that we might write to TPM or
any other verification mechanism.

So I think this should log an error, set a flag to make sure we print
an even louder error after full boot, but still add the mapping and
keep trying.

Good point. This patch can be dropped and replaced by the loud warning,
since it is not required for the functioning of the rest of the series
it is here mainly to indicate bugs in the kernel rather than for the
increased protection. But I would not expect anything in the working
systems, I made my best to map all the things explicitly. And since
no code but the extraction code is supposed to be run (interrupts
are disabled and we are not using any UEFI services there), this should
be practically save to remove the implicit mapping.

And at least this allowed me to find out about the insufficient size of
the boot page tables which did not account for the ACPI and UEFI
mappings. (patch 4 "x86/boot: Increase boot page table size")

If this patch is dropped now, I can send the follow up patch later
adding the warning.

Thanks,
Evgeniy Baskov


--Andy


Tested-by: Mario Limonciello <mario.limonciello@xxxxxxx>
Signed-off-by: Evgeniy Baskov <baskov@xxxxxxxxx>
---
arch/x86/boot/compressed/ident_map_64.c | 26 ++++++++++---------------
 1 file changed, 10 insertions(+), 16 deletions(-)

...



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux