x86: (allow to) override LIST_POISON*
authorJan Beulich <jbeulich@suse.com>
Mon, 17 Nov 2014 14:05:53 +0000 (15:05 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 17 Nov 2014 14:05:53 +0000 (15:05 +0100)
Having these point into space not controlled by the hypervisor provides
an unnecessary attack surface. Allow architectures to override them and
utilize that override to make them non-canonical addresses (thus
causing #GP rather than #PF when dereferenced).

Suggested-by: Andrew Cooper <andrew.cooper3@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
xen/include/asm-x86/config.h
xen/include/xen/list.h

index 210ff576f39e2cd487805ff5d4f48fe47c2b8139..3802721837397e6e9b70a0971e68280f0c5a0227 100644 (file)
 /* Return value for zero-size _xmalloc(), distinguished from NULL. */
 #define ZERO_BLOCK_PTR ((void *)0xBAD0BAD0BAD0BAD0UL)
 
+/* Override include/xen/list.h to make these non-canonical addresses. */
+#define LIST_POISON1  ((void *)0x0100100100100100UL)
+#define LIST_POISON2  ((void *)0x0200200200200200UL)
+
 #ifndef __ASSEMBLY__
 extern unsigned long trampoline_phys;
 #define bootsym_phys(sym)                                 \
index 88dc7ebeb19703e3546ec0721671867bf7038d14..59cf57117dd264467523ff765c1180466e0c1cbd 100644 (file)
 #include <xen/lib.h>
 #include <asm/system.h>
 
-/* These are non-NULL pointers that will result in page faults
- * under normal circumstances, used to verify that nobody uses
- * non-initialized list entries.
+/*
+ * These are non-NULL pointers that will result in faults under normal
+ * circumstances, used to verify that nobody uses non-initialized list
+ * entries. Architectures can override these.
  */
+#ifndef LIST_POISON1
 #define LIST_POISON1  ((void *) 0x00100100)
 #define LIST_POISON2  ((void *) 0x00200200)
+#endif
 
 /*
  * Simple doubly linked list implementation.