* [PATCH] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec and efi=old_map
@ 2017-05-10 22:49 Sai Praneeth Prakhya
[not found] ` <1494456545-26300-1-git-send-email-sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
0 siblings, 1 reply; 3+ messages in thread
From: Sai Praneeth Prakhya @ 2017-05-10 22:49 UTC (permalink / raw)
To: linux-efi-u79uwXL29TY76Z2rM5mHXA,
linux-kernel-u79uwXL29TY76Z2rM5mHXA
Cc: Sai Praneeth, Borislav Petkov, Ricardo Neri, Matt Fleming,
Ard Biesheuvel, Ravi Shankar
From: Sai Praneeth <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
EFI_PGT_DUMP, as the name suggests dumps efi page tables to dmesg during
kernel boot. This feature is very useful while debugging page
faults/null pointer dereferences to efi related addresses. Presently,
this feature is limited only to x86_64, so let's extend it to other efi
configurations like kexec kernel, efi=old_map and to x86_32 as well.
This doesn't effect normal boot path because this config option should
be used only for debug purposes.
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org>
Cc: Ricardo Neri <ricardo.neri-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
Cc: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: Ravi Shankar <ravi.v.shankar-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
---
arch/x86/platform/efi/efi.c | 2 ++
arch/x86/platform/efi/efi_32.c | 9 ++++++++-
arch/x86/platform/efi/efi_64.c | 5 ++++-
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c
index 217dc166c649..a6d6cd8fe78a 100644
--- a/arch/x86/platform/efi/efi.c
+++ b/arch/x86/platform/efi/efi.c
@@ -890,6 +890,8 @@ static void __init kexec_enter_virtual_mode(void)
if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX))
runtime_code_page_mkexec();
+ efi_dump_pagetable();
+
/* clean DUMMY object */
efi_delete_dummy_variable();
#endif
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c
index 9b1abcf6e7bb..9477653c78f8 100644
--- a/arch/x86/platform/efi/efi_32.c
+++ b/arch/x86/platform/efi/efi_32.c
@@ -44,7 +44,14 @@ int __init efi_alloc_page_tables(void)
}
void efi_sync_low_kernel_mappings(void) {}
-void __init efi_dump_pagetable(void) {}
+
+void __init efi_dump_pagetable(void)
+{
+#ifdef CONFIG_EFI_PGT_DUMP
+ ptdump_walk_pgd_level(NULL, swapper_pg_dir);
+#endif
+}
+
int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
{
return 0;
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index 76e1cd6b74dd..3bde2589fdb9 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -510,7 +510,10 @@ void __init efi_runtime_update_mappings(void)
void __init efi_dump_pagetable(void)
{
#ifdef CONFIG_EFI_PGT_DUMP
- ptdump_walk_pgd_level(NULL, efi_pgd);
+ if (efi_enabled(EFI_OLD_MEMMAP))
+ ptdump_walk_pgd_level(NULL, swapper_pg_dir);
+ else
+ ptdump_walk_pgd_level(NULL, efi_pgd);
#endif
}
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread[parent not found: <1494456545-26300-1-git-send-email-sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>]
* Re: [PATCH] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec and efi=old_map [not found] ` <1494456545-26300-1-git-send-email-sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> @ 2017-05-11 11:18 ` Borislav Petkov [not found] ` <20170511111828.pu2i3pn6lyiukgaf-fF5Pk5pvG8Y@public.gmane.org> 0 siblings, 1 reply; 3+ messages in thread From: Borislav Petkov @ 2017-05-11 11:18 UTC (permalink / raw) To: Sai Praneeth Prakhya Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ricardo Neri, Matt Fleming, Ard Biesheuvel, Ravi Shankar On Wed, May 10, 2017 at 03:49:05PM -0700, Sai Praneeth Prakhya wrote: > From: Sai Praneeth <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > EFI_PGT_DUMP, as the name suggests dumps efi page tables to dmesg during > kernel boot. This feature is very useful while debugging page > faults/null pointer dereferences to efi related addresses. Presently, > this feature is limited only to x86_64, so let's extend it to other efi > configurations like kexec kernel, efi=old_map and to x86_32 as well. > This doesn't effect normal boot path because this config option should > be used only for debug purposes. > > Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Cc: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org> > Cc: Ricardo Neri <ricardo.neri-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > Cc: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> > Cc: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > Cc: Ravi Shankar <ravi.v.shankar-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > --- > arch/x86/platform/efi/efi.c | 2 ++ > arch/x86/platform/efi/efi_32.c | 9 ++++++++- > arch/x86/platform/efi/efi_64.c | 5 ++++- > 3 files changed, 14 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c > index 217dc166c649..a6d6cd8fe78a 100644 > --- a/arch/x86/platform/efi/efi.c > +++ b/arch/x86/platform/efi/efi.c > @@ -890,6 +890,8 @@ static void __init kexec_enter_virtual_mode(void) > if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) > runtime_code_page_mkexec(); > > + efi_dump_pagetable(); You can call that only once at the end of efi_enter_virtual_mode() instead of adding it here and leaving it in __efi_enter_virtual_mode(). -- Regards/Gruss, Boris. Good mailing practices for 400: avoid top-posting and trim the reply. ^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <20170511111828.pu2i3pn6lyiukgaf-fF5Pk5pvG8Y@public.gmane.org>]
* Re: [PATCH] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec and efi=old_map [not found] ` <20170511111828.pu2i3pn6lyiukgaf-fF5Pk5pvG8Y@public.gmane.org> @ 2017-05-11 18:44 ` Sai Praneeth Prakhya 0 siblings, 0 replies; 3+ messages in thread From: Sai Praneeth Prakhya @ 2017-05-11 18:44 UTC (permalink / raw) To: Borislav Petkov Cc: linux-efi-u79uwXL29TY76Z2rM5mHXA, linux-kernel-u79uwXL29TY76Z2rM5mHXA, Ricardo Neri, Matt Fleming, Ard Biesheuvel, Ravi Shankar On Thu, 2017-05-11 at 13:18 +0200, Borislav Petkov wrote: > On Wed, May 10, 2017 at 03:49:05PM -0700, Sai Praneeth Prakhya wrote: > > From: Sai Praneeth <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > > > EFI_PGT_DUMP, as the name suggests dumps efi page tables to dmesg during > > kernel boot. This feature is very useful while debugging page > > faults/null pointer dereferences to efi related addresses. Presently, > > this feature is limited only to x86_64, so let's extend it to other efi > > configurations like kexec kernel, efi=old_map and to x86_32 as well. > > This doesn't effect normal boot path because this config option should > > be used only for debug purposes. > > > > Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > Cc: Borislav Petkov <bp-Gina5bIWoIWzQB+pC5nmwQ@public.gmane.org> > > Cc: Ricardo Neri <ricardo.neri-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > Cc: Matt Fleming <matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org> > > Cc: Ard Biesheuvel <ard.biesheuvel-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> > > Cc: Ravi Shankar <ravi.v.shankar-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> > > --- > > arch/x86/platform/efi/efi.c | 2 ++ > > arch/x86/platform/efi/efi_32.c | 9 ++++++++- > > arch/x86/platform/efi/efi_64.c | 5 ++++- > > 3 files changed, 14 insertions(+), 2 deletions(-) > > > > diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c > > index 217dc166c649..a6d6cd8fe78a 100644 > > --- a/arch/x86/platform/efi/efi.c > > +++ b/arch/x86/platform/efi/efi.c > > @@ -890,6 +890,8 @@ static void __init kexec_enter_virtual_mode(void) > > if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) > > runtime_code_page_mkexec(); > > > > + efi_dump_pagetable(); > > You can call that only once at the end of efi_enter_virtual_mode() > instead of adding it here and leaving it in __efi_enter_virtual_mode(). > Thanks for the suggestion Boris, Sure! will roll out v2 with this change Regards, Sai ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-11 18:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-10 22:49 [PATCH] x86/efi: Add EFI_PGT_DUMP support for x86_32, kexec and efi=old_map Sai Praneeth Prakhya
[not found] ` <1494456545-26300-1-git-send-email-sai.praneeth.prakhya-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-05-11 11:18 ` Borislav Petkov
[not found] ` <20170511111828.pu2i3pn6lyiukgaf-fF5Pk5pvG8Y@public.gmane.org>
2017-05-11 18:44 ` Sai Praneeth Prakhya
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).