aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-08-17 15:26:53 -0400
committerJeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>2009-08-19 20:09:28 -0400
commitce2eef33d35cd7b932492b5a81fb0febd2b323cd (patch)
tree46a6e2f61ae26428f95f991f9c61a4a01f299a06 /arch
parent5416c2663517ebd0be0664c4d4ce3df0b116c059 (diff)
xen: rearrange things to fix stackprotector
Make sure the stack-protector segment registers are properly set up before calling any functions which may have stack-protection compiled into them. [ Impact: prevent Xen early-boot crash when stack-protector is enabled ] Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/x86/xen/Makefile4
-rw-r--r--arch/x86/xen/enlighten.c22
2 files changed, 14 insertions, 12 deletions
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 3b767d03fd6..a5b9288b7da 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -5,6 +5,10 @@ CFLAGS_REMOVE_time.o = -pg
5CFLAGS_REMOVE_irq.o = -pg 5CFLAGS_REMOVE_irq.o = -pg
6endif 6endif
7 7
8# Make sure early boot has no stackprotector
9nostackp := $(call cc-option, -fno-stack-protector)
10CFLAGS_enlighten.o := $(nostackp)
11
8obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ 12obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
9 time.o xen-asm.o xen-asm_$(BITS).o \ 13 time.o xen-asm.o xen-asm_$(BITS).o \
10 grant-table.o suspend.o 14 grant-table.o suspend.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index f09e8c36ee8..edcf72a3c29 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -925,10 +925,6 @@ asmlinkage void __init xen_start_kernel(void)
925 925
926 xen_domain_type = XEN_PV_DOMAIN; 926 xen_domain_type = XEN_PV_DOMAIN;
927 927
928 BUG_ON(memcmp(xen_start_info->magic, "xen-3", 5) != 0);
929
930 xen_setup_features();
931
932 /* Install Xen paravirt ops */ 928 /* Install Xen paravirt ops */
933 pv_info = xen_info; 929 pv_info = xen_info;
934 pv_init_ops = xen_init_ops; 930 pv_init_ops = xen_init_ops;
@@ -937,8 +933,15 @@ asmlinkage void __init xen_start_kernel(void)
937 pv_apic_ops = xen_apic_ops; 933 pv_apic_ops = xen_apic_ops;
938 pv_mmu_ops = xen_mmu_ops; 934 pv_mmu_ops = xen_mmu_ops;
939 935
940 xen_init_irq_ops(); 936#ifdef CONFIG_X86_64
937 /*
938 * Setup percpu state. We only need to do this for 64-bit
939 * because 32-bit already has %fs set properly.
940 */
941 load_percpu_segment(0);
942#endif
941 943
944 xen_init_irq_ops();
942 xen_init_cpuid_mask(); 945 xen_init_cpuid_mask();
943 946
944#ifdef CONFIG_X86_LOCAL_APIC 947#ifdef CONFIG_X86_LOCAL_APIC
@@ -948,6 +951,8 @@ asmlinkage void __init xen_start_kernel(void)
948 set_xen_basic_apic_ops(); 951 set_xen_basic_apic_ops();
949#endif 952#endif
950 953
954 xen_setup_features();
955
951 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) { 956 if (xen_feature(XENFEAT_mmu_pt_update_preserve_ad)) {
952 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start; 957 pv_mmu_ops.ptep_modify_prot_start = xen_ptep_modify_prot_start;
953 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit; 958 pv_mmu_ops.ptep_modify_prot_commit = xen_ptep_modify_prot_commit;
@@ -955,13 +960,6 @@ asmlinkage void __init xen_start_kernel(void)
955 960
956 machine_ops = xen_machine_ops; 961 machine_ops = xen_machine_ops;
957 962
958#ifdef CONFIG_X86_64
959 /*
960 * Setup percpu state. We only need to do this for 64-bit
961 * because 32-bit already has %fs set properly.
962 */
963 load_percpu_segment(0);
964#endif
965 /* 963 /*
966 * The only reliable way to retain the initial address of the 964 * The only reliable way to retain the initial address of the
967 * percpu gdt_page is to remember it here, so we can go and 965 * percpu gdt_page is to remember it here, so we can go and