lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20141008222619.GG16892@pd.tnic>
Date:	Thu, 9 Oct 2014 00:26:19 +0200
From:	Borislav Petkov <bp@...en8.de>
To:	Mathias Krause <minipli@...glemail.com>
Cc:	Matt Fleming <matt@...sole-pimps.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	x86-ml <x86@...nel.org>, Matt Fleming <matt.fleming@...el.com>
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.
--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ