Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1160427

[Patch V4 09/16] xen: check for kernel memory conflicting with memory layout

From Juergen Gross <jgross@suse.com>
Newsgroups linux.kernel
Subject [Patch V4 09/16] xen: check for kernel memory conflicting with memory layout
Date 2015-06-08 14:10 +0200
Message-ID <pz42n-6vb-15@gated-at.bofh.it> (permalink)
References <pz42l-6vb-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Checks whether the pre-allocated memory of the loaded kernel is in
conflict with the target memory map. If this is the case, just panic
instead of run into problems later, as there is nothing we can do
to repair this situation.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: David Vrabel <david.vrabel@citrix.com>
---
 arch/x86/xen/setup.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 973d294..9bd3f35 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -27,6 +27,7 @@
 #include <xen/interface/memory.h>
 #include <xen/interface/physdev.h>
 #include <xen/features.h>
+#include <xen/hvc-console.h>
 #include "xen-ops.h"
 #include "vdso.h"
 #include "p2m.h"
@@ -790,6 +791,17 @@ char * __init xen_memory_setup(void)
 
 	sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
 
+	/*
+	 * Check whether the kernel itself conflicts with the target E820 map.
+	 * Failing now is better than running into weird problems later due
+	 * to relocating (and even reusing) pages with kernel text or data.
+	 */
+	if (xen_is_e820_reserved(__pa_symbol(_text),
+			__pa_symbol(__bss_stop) - __pa_symbol(_text))) {
+		xen_raw_console_write("Xen hypervisor allocated kernel memory conflicts with E820 map\n");
+		BUG();
+	}
+
 	xen_reserve_xen_mfnlist();
 
 	/*
-- 
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/

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[Patch V4 00/16] xen: support pv-domains larger than 512GB Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 06/16] xen: split counting of extra memory pages from remapping Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 11/16] xen: check for initrd conflicting with e820 map Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 09/16] xen: check for kernel memory conflicting with memory layout Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 01/16] xen: sync with xen headers Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 16/16] xen: remove no longer needed p2m.h Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 14/16] xen: move p2m list if conflicting with e820 map Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
    Re: [Xen-devel] [Patch V4 14/16] xen: move p2m list if conflicting  with e820 map David Vrabel <david.vrabel@citrix.com> - 2015-06-11 13:10 +0200
  [Patch V4 07/16] xen: check memory area against e820 map Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 10/16] xen: check pre-allocated page tables for conflict with memory map Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 15/16] xen: allow more than 512 GB of RAM for 64 bit pv-domains Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 02/16] xen: save linear p2m list address in shared info structure Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 08/16] xen: find unused contiguous memory area Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 13/16] xen: add explicit memblock_reserve() calls for special pages Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200
  [Patch V4 12/16] mm: provide early_memremap_ro to establish read-only mapping Juergen Gross <jgross@suse.com> - 2015-06-08 14:10 +0200

csiph-web