[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen stable-4.2] x86-64/percpu: Force INVALID_PERCPU_AREA into the non-canonical address region



commit 1985d0a0723ba39b22fc5114d69ed510831b13ac
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Feb 20 08:40:24 2014 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Feb 20 08:40:24 2014 +0100

    x86-64/percpu: Force INVALID_PERCPU_AREA into the non-canonical address 
region
    
    This causes accidental uses of per_cpu() on a pcpu with an 
INVALID_PERCPU_AREA
    to result in a #GF for attempting to access the middle of the non-canonical
    virtual address region.
    
    This is preferable to the current behaviour, where incorrect use of 
per_cpu()
    will result in an effective NULL structure dereference which has security
    implication in the context of PV guests.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Acked-by: Keir Fraser <keir@xxxxxxx>
    master commit: 7cfb0053629c4dd1a6f01dc43cca7c0c25b8b7bf
    master date: 2013-10-04 12:24:34 +0200
---
 xen/arch/x86/percpu.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/xen/arch/x86/percpu.c b/xen/arch/x86/percpu.c
index e545024..441e350 100644
--- a/xen/arch/x86/percpu.c
+++ b/xen/arch/x86/percpu.c
@@ -6,7 +6,17 @@
 #include <xen/rcupdate.h>
 
 unsigned long __per_cpu_offset[NR_CPUS];
+#ifdef __i386__
 #define INVALID_PERCPU_AREA (-(long)__per_cpu_start)
+#else
+/*
+ * Force uses of per_cpu() with an invalid area to attempt to access the
+ * middle of the non-canonical address space resulting in a #GP, rather than a
+ * possible #PF at (NULL + a little) which has security implications in the
+ * context of PV guests.
+ */
+#define INVALID_PERCPU_AREA (0x8000000000000000L - (long)__per_cpu_start)
+#endif
 #define PERCPU_ORDER (get_order_from_bytes(__per_cpu_data_end-__per_cpu_start))
 
 void __init percpu_init_areas(void)
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.2

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.