Re: [PATCH 4/4] x86, efi: Map runtime services 1:1

H. Peter Anvin
2013-06-06T19:28:20Z

On 06/06/2013 08:58 AM, Borislav Petkov wrote:
> --
> diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
> index 654be4ae3047..7a6129afdff1 100644
> --- a/arch/x86/mm/fault.c
> +++ b/arch/x86/mm/fault.c
> @@ -1021,6 +1021,9 @@ __do_page_fault(struct pt_regs *regs, unsigned long error_code)
> /* Get the faulting address: */
> address = read_cr2();
>
> + if (read_cr3() == (unsigned long)real_mode_header->trampoline_pgd)
> + pr_err("%s: #PF addr: 0x%lx\n", __func__, address);
> +
> /*
> * Detect and handle instructions that would cause a page fault for
> * both a tracked kernel page and a userspace page.
>

Or we could materialize mappings for this specific PGD. However, adding
a read of %cr3 in __do_page_fault sounds expensive.

-hpa