HomeFreeBSD

riscv: Exclude OpenSBI memory regions when booting with EFI

Description

riscv: Exclude OpenSBI memory regions when booting with EFI

OpenSBI uses the first PMP entry to prevent buggy supervisor
software from overwriting the firmware [1]. However, this
region may not be properly marked as reserved in the EFI map, leading
to an access violation exception whenever the kernel
attempts to write to a page from that region.

Fix this by preemptively excluding first EFI memory map entry
if it is marked as "BootServicesData".

[1] https://github.com/riscv-non-isa/riscv-sbi-doc/pull/37

Reported by: tuexen
Tested by: tuexen
Fixes: a2e2178402af
Reviewed by: imp, jrtc27
Differential Revision: https://reviews.freebsd.org/D49839

Details

Provenance
bnovkovAuthored on Tue, Apr 15, 4:28 PM
Reviewer
imp
Differential Revision
D49839: riscv: Exclude OpenSBI memory regions when booting with EFI
Parents
rG20e6354fe783: git-arc.1: Clarify argument format for group reviewers
Branches
Unknown
Tags
Unknown