Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1698674 > unrolled thread
| Started by | Juergen Gross <jgross@suse.com> |
|---|---|
| First post | 2017-07-28 12:30 +0200 |
| Last post | 2017-07-28 12:30 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
[PATCH v2 0/3] fix xen hvm guest with kaslr enabled Juergen Gross <jgross@suse.com> - 2017-07-28 12:30 +0200
[PATCH v2 3/3] xen: fix hvm guest with kaslr enabled Juergen Gross <jgross@suse.com> - 2017-07-28 12:30 +0200
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-07-28 12:30 +0200 |
| Subject | [PATCH v2 0/3] fix xen hvm guest with kaslr enabled |
| Message-ID | <u8aGR-2tk-3@gated-at.bofh.it> |
This patch series fixes a regression introduced in 4.13-rc1: A Xen HVM guest with KASLR enabled wouldn't boot any longer due to the usage of __va() before kernel_randomize_memory() was called. Changes in V2: - patch 1: test for x86_hyper being not NULL Juergen Gross (3): x86: provide an init_mem_mapping hypervisor hook xen: split up xen_hvm_init_shared_info() xen: fix hvm guest with kaslr enabled arch/x86/include/asm/hypervisor.h | 10 +++++++ arch/x86/mm/init.c | 3 ++ arch/x86/xen/enlighten_hvm.c | 59 ++++++++++++++++++++++++--------------- 3 files changed, 50 insertions(+), 22 deletions(-) -- 2.12.3
[toc] | [next] | [standalone]
| From | Juergen Gross <jgross@suse.com> |
|---|---|
| Date | 2017-07-28 12:30 +0200 |
| Subject | [PATCH v2 3/3] xen: fix hvm guest with kaslr enabled |
| Message-ID | <u8aGS-2tk-15@gated-at.bofh.it> |
| In reply to | #1698674 |
A Xen HVM guest running with KASLR enabled will die rather soon today
due to the shared info page mapping is using va() too early. This was
introduced by commit a5d5f328b0e2baa5ee7c119fd66324eb79eeeb66 ("xen:
allocate page for shared info page from low memory").
In order to fix this use early_memremap() to get a temporary virtual
address for shared info until va() can be used safely.
Signed-off-by: Juergen Gross <jgross@suse.com>
---
arch/x86/xen/enlighten_hvm.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/arch/x86/xen/enlighten_hvm.c b/arch/x86/xen/enlighten_hvm.c
index d23531f5f17e..de503c225ae1 100644
--- a/arch/x86/xen/enlighten_hvm.c
+++ b/arch/x86/xen/enlighten_hvm.c
@@ -12,6 +12,7 @@
#include <asm/setup.h>
#include <asm/hypervisor.h>
#include <asm/e820/api.h>
+#include <asm/early_ioremap.h>
#include <asm/xen/cpuid.h>
#include <asm/xen/hypervisor.h>
@@ -21,6 +22,8 @@
#include "mmu.h"
#include "smp.h"
+static unsigned long shared_info_pfn;
+
void xen_hvm_init_shared_info(void)
{
struct xen_add_to_physmap xatp;
@@ -28,7 +31,7 @@ void xen_hvm_init_shared_info(void)
xatp.domid = DOMID_SELF;
xatp.idx = 0;
xatp.space = XENMAPSPACE_shared_info;
- xatp.gpfn = virt_to_pfn(HYPERVISOR_shared_info);
+ xatp.gpfn = shared_info_pfn;
if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
BUG();
}
@@ -51,8 +54,16 @@ static void __init reserve_shared_info(void)
pa += PAGE_SIZE)
;
+ shared_info_pfn = PHYS_PFN(pa);
+
memblock_reserve(pa, PAGE_SIZE);
- HYPERVISOR_shared_info = __va(pa);
+ HYPERVISOR_shared_info = early_memremap(pa, PAGE_SIZE);
+}
+
+static void __init xen_hvm_init_mem_mapping(void)
+{
+ early_memunmap(HYPERVISOR_shared_info, PAGE_SIZE);
+ HYPERVISOR_shared_info = __va(PFN_PHYS(shared_info_pfn));
}
static void __init init_hvm_pv_info(void)
@@ -221,5 +232,6 @@ const struct hypervisor_x86 x86_hyper_xen_hvm = {
.init_platform = xen_hvm_guest_init,
.pin_vcpu = xen_pin_vcpu,
.x2apic_available = xen_x2apic_para_available,
+ .init_mem_mapping = xen_hvm_init_mem_mapping,
};
EXPORT_SYMBOL(x86_hyper_xen_hvm);
--
2.12.3
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web