Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1246080 > unrolled thread
| Started by | Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> |
|---|---|
| First post | 2015-10-13 21:50 +0200 |
| Last post | 2015-10-14 16:50 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> - 2015-10-13 21:50 +0200
Re: [PATCH] x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled Borislav Petkov <bp@alien8.de> - 2015-10-14 16:50 +0200
| From | Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com> |
|---|---|
| Date | 2015-10-13 21:50 +0200 |
| Subject | [PATCH] x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled |
| Message-ID | <qjdK9-80D-11@gated-at.bofh.it> |
From: Sai Praneeth <sai.praneeth.prakhya@intel.com>
When CONFIG_DEBUG_VIRTUAL is turned on, all accesses to __pa(address)
are monitored to see whether address falls in direct mapping or kernel
mapping, if it does not kernel panics. During 1:1 mapping of EFI runtime
services we access addresses which are below 4G and hence when passed as
arguments to __pa() kernel panics as reported by Dave Hansen here
https://lkml.org/lkml/2015/1/27/742. So, before calling __pa() virtual
addresses should be validated which results in skipping call to
split_page_count() and that should be fine because it is used to keep
track of direct kernel mappings and not 1:1 mappings.
Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
Reported-by: Dave Hansen <dave.hansen@intel.com>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Ricardo Neri <ricardo.neri@intel.com>
Cc: Glenn P Williamson <glenn.p.williamson@intel.com>
Cc: Ravi Shankar <ravi.v.shankar@intel.com>
---
arch/x86/mm/pageattr.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index 727158cb3b3c..3a603830503a 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -648,9 +648,11 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address,
for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc)
set_pte(&pbase[i], pfn_pte(pfn, canon_pgprot(ref_prot)));
- if (pfn_range_is_mapped(PFN_DOWN(__pa(address)),
- PFN_DOWN(__pa(address)) + 1))
- split_page_count(level);
+ if (virt_addr_valid(address)) {
+ if (pfn_range_is_mapped(PFN_DOWN(__pa(address)),
+ PFN_DOWN(__pa(address)) + 1))
+ split_page_count(level);
+ }
/*
* Install the new, split up pagetable.
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Borislav Petkov <bp@alien8.de> |
|---|---|
| Date | 2015-10-14 16:50 +0200 |
| Subject | Re: [PATCH] x86/efi: Fix kernel panic when CONFIG_DEBUG_VIRTUAL is enabled |
| Message-ID | <qjvxo-1x9-5@gated-at.bofh.it> |
| In reply to | #1246080 |
On Tue, Oct 13, 2015 at 12:42:57PM -0700, Sai Praneeth Prakhya wrote:
> From: Sai Praneeth <sai.praneeth.prakhya@intel.com>
>
> When CONFIG_DEBUG_VIRTUAL is turned on, all accesses to __pa(address)
> are monitored to see whether address falls in direct mapping or kernel
> mapping,
make that
"... or kernel text mapping (see Documentation/x86/x86_64/mm.txt for
details)"
for more clarity please. It just took mfleming and me a while to figure
out what what is.
> if it does not kernel panics. During 1:1 mapping of EFI runtime
> services we access addresses which are below 4G and hence when passed as
not "below 4G" but "we access virtual adresses which are == physical
addresses, thus the 1:1 mapping" - on a box with more than 4G, physical
addresses can be above 4G too :)
> arguments to __pa() kernel panics as reported by Dave Hansen here
> https://lkml.org/lkml/2015/1/27/742.
Please quote this mail with the k.org redirector:
https://lkml.kernel.org/r/5462999A.7090706@intel.com
lkml.org is unreliable.
> So, before calling __pa() virtual
> addresses should be validated which results in skipping call to
> split_page_count() and that should be fine because it is used to keep
> track of direct kernel mappings and not 1:1 mappings.
I think that should say:
"to keep track of everything *but* 1:1 mappings."
The 1:1 mappings are EFI-specific thing and the physaddr.c checkers
aren't aware of them.
Again, IMHO.
> Signed-off-by: Sai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
> Reported-by: Dave Hansen <dave.hansen@intel.com>
> Cc: Matt Fleming <matt.fleming@intel.com>
> Cc: Ricardo Neri <ricardo.neri@intel.com>
> Cc: Glenn P Williamson <glenn.p.williamson@intel.com>
> Cc: Ravi Shankar <ravi.v.shankar@intel.com>
> ---
> arch/x86/mm/pageattr.c | 8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
> index 727158cb3b3c..3a603830503a 100644
> --- a/arch/x86/mm/pageattr.c
> +++ b/arch/x86/mm/pageattr.c
> @@ -648,9 +648,11 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address,
> for (i = 0; i < PTRS_PER_PTE; i++, pfn += pfninc)
> set_pte(&pbase[i], pfn_pte(pfn, canon_pgprot(ref_prot)));
>
> - if (pfn_range_is_mapped(PFN_DOWN(__pa(address)),
> - PFN_DOWN(__pa(address)) + 1))
> - split_page_count(level);
> + if (virt_addr_valid(address)) {
> + if (pfn_range_is_mapped(PFN_DOWN(__pa(address)),
> + PFN_DOWN(__pa(address)) + 1))
> + split_page_count(level);
Maybe make it a bit more readable:
if (virt_addr_valid(address)) {
unsigned long pfn = PFN_DOWN(__pa(address));
if (pfn_range_is_mapped(pfn, pfn + 1))
split_page_count(level);
}
But yeah, patch makes sense to me.
Thanks for fixing that!
--
Regards/Gruss,
Boris.
ECO tip #101: Trim your mails when you reply.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web