Messages in this thread | | | Date | Thu, 9 Oct 2014 00:26:19 +0200 | From | Borislav Petkov <> | Subject | Re: [PATCHv2 1/3] x86, ptdump: Add section for EFI runtime services |
| |
On Wed, Oct 08, 2014 at 11:58:20PM +0200, Mathias Krause wrote: > Well, that is only partly correct. The call chain in efi_map_regions() > [ -> efi_map_region() -> __map_region() -> kernel_map_pages_in_pgd() > -> ..."magic"... ] does not only map the EFI regions in > trampoline_pgd, but also in kernel page table, i.e. init_level4_pgt.
No, this is completely correct. If it isn't, then it needs to be. We can't have EFI mappings in the kernel page table for a reason.
EFI mappings only land in trampoline_pgd, not in the kernel page table, .i.e *not* in init_level4_pgt. Look at what the first argument of every invocation of kernel_map_pages_in_pgd() is.
> That can easily be shown by looking at the kernel_page_tables debugfs > file on a running system. You'll notice large RWX portions covering > the "phys" mappings in the "Low Kernel Mapping" area and the "virt" > mappings in the "EFI Runtime Services" area. Now reboot with "noefi" > and see those be gone.
You need to show me - I don't see them here, in my guest.
> Well, beside the debugfs file is always using init_level4_pgt, reality > shows the EFI mappings are visible there, too. So why omit them?
Again, you need to show me - I don't see any EFI mappings in my setup here when cat-ting /sys/kernel/debug/kernel_page_tables
> Well, maybe I got it all wrong and there should be no EFI mappings in > the kernel page table at all? If so, how about fixing > kernel_map_pages_in_pgd() to not do so? It's you're code after all... > ;)
Well, if you can show me where kernel_map_pages_in_pgd() is called with init_level4_pgt as a first argument, I'd gladly fix it.
The 3 calls to it in 3.17 are all in efi_64.c and everytime it is real_mode_header->trampoline_pgd that gets handed down:
arch/x86/platform/efi/efi_64.c:161: if (kernel_map_pages_in_pgd(pgd, pa_memmap, pa_memmap, num_pages, _PAGE_NX)) { arch/x86/platform/efi/efi_64.c:187: if (kernel_map_pages_in_pgd(pgd, text >> PAGE_SHIFT, text, npages, 0)) { arch/x86/platform/efi/efi_64.c:210: if (kernel_map_pages_in_pgd(pgd, md->phys_addr, va, md->num_pages, pf))
So show me please what exactly you're seeing.
-- Regards/Gruss, Boris.
Sent from a fat crate under my desk. Formatting is fine. --
| |