From: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
To: Linux EFI <linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>,
Matt Fleming
<matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>,
Matthew Garrett <mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org>,
"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
Toshi Kani <toshi.kani-VXdhtT5mjnY@public.gmane.org>
Subject: [PATCH 2/5] efi: Dump the EFI page table
Date: Sat, 18 Jan 2014 12:48:15 +0100 [thread overview]
Message-ID: <1390045698-16882-3-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1390045698-16882-1-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
From: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
This is very useful for debugging issues with the recently added
pagetable switching code for EFI virtual mode.
Signed-off-by: Borislav Petkov <bp-l3A5Bk7waGM@public.gmane.org>
Tested-by: Toshi Kani <toshi.kani-VXdhtT5mjnY@public.gmane.org>
---
arch/x86/Kconfig | 9 +++++++++
arch/x86/include/asm/efi.h | 1 +
arch/x86/platform/efi/efi.c | 1 +
arch/x86/platform/efi/efi_32.c | 1 +
arch/x86/platform/efi/efi_64.c | 9 +++++++++
5 files changed, 21 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 02241d8dcab6..ba0d86cca926 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1614,6 +1614,15 @@ config EFI_STUB
See Documentation/efi-stub.txt for more information.
+config EFI_PGT_DUMP
+ bool "Dump the EFI pagetable"
+ depends on EFI && X86_PTDUMP
+ ---help---
+ Enable this if you want to dump the EFI page table before
+ enabling virtual mode. This can be used to debug miscellaneous
+ issues with the mapping of the EFI runtime regions into that
+ table.
+
config SECCOMP
def_bool y
prompt "Enable seccomp to safely compute untrusted bytecode"
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 3b978c472d08..dfc319e7a7b8 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -132,6 +132,7 @@ extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
extern void efi_sync_low_kernel_mappings(void);
extern void efi_setup_page_tables(void);
extern void __init old_map_region(efi_memory_desc_t *md);
+extern void __init efi_dump_pagetable(void);
struct efi_setup_data {
u64 fw_vendor;
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index d62ec87a2b26..35450ab3a123 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1033,6 +1033,7 @@ void __init efi_enter_virtual_mode(void)
efi_setup_page_tables();
efi_sync_low_kernel_mappings();
+ efi_dump_pagetable();
if (!efi_setup) {
status = phys_efi_set_virtual_address_map(
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 249b183cf417..b9b827cbfecc 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -41,6 +41,7 @@ static unsigned long efi_rt_eflags;
void efi_sync_low_kernel_mappings(void) {}
void efi_setup_page_tables(void) {}
+void __init efi_dump_pagetable(void) {}
void __init efi_map_region(efi_memory_desc_t *md)
{
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 6284f158a47d..76fce828c31d 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -233,3 +233,12 @@ void __init parse_efi_setup(u64 phys_addr, u32 data_len)
{
efi_setup = phys_addr + sizeof(struct setup_data);
}
+
+void __init efi_dump_pagetable(void)
+{
+#ifdef CONFIG_EFI_PGT_DUMP
+ pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
+
+ ptdump_walk_pgd_level(NULL, pgd);
+#endif
+}
--
1.8.5.2.192.g7794a68
WARNING: multiple messages have this Message-ID (diff)
From: Borislav Petkov <bp@alien8.de>
To: Linux EFI <linux-efi@vger.kernel.org>
Cc: LKML <linux-kernel@vger.kernel.org>, Borislav Petkov <bp@suse.de>,
Matt Fleming <matt@console-pimps.org>,
Matthew Garrett <mjg59@srcf.ucam.org>,
"H. Peter Anvin" <hpa@zytor.com>, Toshi Kani <toshi.kani@hp.com>
Subject: [PATCH 2/5] efi: Dump the EFI page table
Date: Sat, 18 Jan 2014 12:48:15 +0100 [thread overview]
Message-ID: <1390045698-16882-3-git-send-email-bp@alien8.de> (raw)
In-Reply-To: <1390045698-16882-1-git-send-email-bp@alien8.de>
From: Borislav Petkov <bp@suse.de>
This is very useful for debugging issues with the recently added
pagetable switching code for EFI virtual mode.
Signed-off-by: Borislav Petkov <bp@suse.de>
Tested-by: Toshi Kani <toshi.kani@hp.com>
---
arch/x86/Kconfig | 9 +++++++++
arch/x86/include/asm/efi.h | 1 +
arch/x86/platform/efi/efi.c | 1 +
arch/x86/platform/efi/efi_32.c | 1 +
arch/x86/platform/efi/efi_64.c | 9 +++++++++
5 files changed, 21 insertions(+)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 02241d8dcab6..ba0d86cca926 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -1614,6 +1614,15 @@ config EFI_STUB
See Documentation/efi-stub.txt for more information.
+config EFI_PGT_DUMP
+ bool "Dump the EFI pagetable"
+ depends on EFI && X86_PTDUMP
+ ---help---
+ Enable this if you want to dump the EFI page table before
+ enabling virtual mode. This can be used to debug miscellaneous
+ issues with the mapping of the EFI runtime regions into that
+ table.
+
config SECCOMP
def_bool y
prompt "Enable seccomp to safely compute untrusted bytecode"
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
index 3b978c472d08..dfc319e7a7b8 100644
--- a/arch/x86/include/asm/efi.h
+++ b/arch/x86/include/asm/efi.h
@@ -132,6 +132,7 @@ extern void __init efi_map_region_fixed(efi_memory_desc_t *md);
extern void efi_sync_low_kernel_mappings(void);
extern void efi_setup_page_tables(void);
extern void __init old_map_region(efi_memory_desc_t *md);
+extern void __init efi_dump_pagetable(void);
struct efi_setup_data {
u64 fw_vendor;
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index d62ec87a2b26..35450ab3a123 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -1033,6 +1033,7 @@ void __init efi_enter_virtual_mode(void)
efi_setup_page_tables();
efi_sync_low_kernel_mappings();
+ efi_dump_pagetable();
if (!efi_setup) {
status = phys_efi_set_virtual_address_map(
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 249b183cf417..b9b827cbfecc 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -41,6 +41,7 @@ static unsigned long efi_rt_eflags;
void efi_sync_low_kernel_mappings(void) {}
void efi_setup_page_tables(void) {}
+void __init efi_dump_pagetable(void) {}
void __init efi_map_region(efi_memory_desc_t *md)
{
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 6284f158a47d..76fce828c31d 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -233,3 +233,12 @@ void __init parse_efi_setup(u64 phys_addr, u32 data_len)
{
efi_setup = phys_addr + sizeof(struct setup_data);
}
+
+void __init efi_dump_pagetable(void)
+{
+#ifdef CONFIG_EFI_PGT_DUMP
+ pgd_t *pgd = (pgd_t *)__va(real_mode_header->trampoline_pgd);
+
+ ptdump_walk_pgd_level(NULL, pgd);
+#endif
+}
--
1.8.5.2.192.g7794a68
next prev parent reply other threads:[~2014-01-18 11:48 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-18 11:48 [PATCH 0/5] EFI memmap and other fixes, v3 Borislav Petkov
2014-01-18 11:48 ` Borislav Petkov
[not found] ` <1390045698-16882-1-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
2014-01-18 11:48 ` [PATCH 1/5] x86, ptdump: Add the functionality to dump an arbitrary pagetable Borislav Petkov
2014-01-18 11:48 ` Borislav Petkov
2014-01-18 11:48 ` Borislav Petkov [this message]
2014-01-18 11:48 ` [PATCH 2/5] efi: Dump the EFI page table Borislav Petkov
2014-01-20 13:38 ` Matt Fleming
[not found] ` <20140120133802.GA684-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-01-20 13:41 ` Borislav Petkov
2014-01-20 13:41 ` Borislav Petkov
2014-01-18 11:48 ` [PATCH 3/5] x86, pageattr: Export page unmapping interface Borislav Petkov
2014-01-18 11:48 ` [PATCH 4/5] efi: Make efi virtual runtime map passing more robust Borislav Petkov
2014-01-18 11:48 ` [PATCH 5/5] efi: Split efi_enter_virtual_mode Borislav Petkov
[not found] ` <1390045698-16882-6-git-send-email-bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
2014-01-20 13:44 ` Matt Fleming
2014-01-20 13:44 ` Matt Fleming
[not found] ` <20140120134407.GB684-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org>
2014-01-20 13:46 ` Borislav Petkov
2014-01-20 13:46 ` Borislav Petkov
[not found] ` <20140120134625.GD3003-fF5Pk5pvG8Y@public.gmane.org>
2014-01-20 14:48 ` Matt Fleming
2014-01-20 14:48 ` Matt Fleming
2014-01-23 9:06 ` [PATCH 0/5] EFI memmap and other fixes, v3 Matt Fleming
2014-01-23 16:30 ` Toshi Kani
[not found] ` <1390494619.1792.482.camel-RbGIw1UOYPVo/CpIj0byZw@public.gmane.org>
2014-01-23 16:51 ` Borislav Petkov
2014-01-23 16:51 ` Borislav Petkov
[not found] ` <20140123165109.GA11190-fF5Pk5pvG8Y@public.gmane.org>
2014-01-23 16:56 ` Toshi Kani
2014-01-23 16:56 ` Toshi Kani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1390045698-16882-3-git-send-email-bp@alien8.de \
--to=bp-gina5biwoiwzqb+pc5nmwq@public.gmane.org \
--cc=bp-l3A5Bk7waGM@public.gmane.org \
--cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
--cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=matt-HNK1S37rvNbeXh+fF434Mdi2O/JbrIOy@public.gmane.org \
--cc=mjg59-1xO5oi07KQx4cg9Nei1l7Q@public.gmane.org \
--cc=toshi.kani-VXdhtT5mjnY@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.