Skip to content

Commit 36104cb

Browse files
jandryukBoris Ostrovsky
authored andcommitted
x86/xen: Delay get_cpu_cap until stack canary is established
Commit 2cc42ba ("x86-64/Xen: eliminate W+X mappings") introduced a call to get_cpu_cap, which is fstack-protected. This is works on x86-64 as commit 4f27729 ("x86/xen: init %gs very early to avoid page faults with stack protector") ensures the stack protector is configured, but it it did not cover x86-32. Delay calling get_cpu_cap until after xen_setup_gdt has initialized the stack canary. Without this, a 32bit PV machine crashes early in boot. (XEN) Domain 0 (vcpu#0) crashed on cpu#0: (XEN) ----[ Xen-4.6.6-xc x86_64 debug=n Tainted: C ]---- (XEN) CPU: 0 (XEN) RIP: e019:[<00000000c10362f8>] And the PV kernel IP corresponds to init_scattered_cpuid_features 0xc10362f8 <+24>: mov %gs:0x14,%eax Fixes 2cc42ba ("x86-64/Xen: eliminate W+X mappings") Signed-off-by: Jason Andryuk <[email protected]> Reviewed-by: Boris Ostrovsky <[email protected]> Signed-off-by: Boris Ostrovsky <[email protected]>
1 parent 8fe5ab4 commit 36104cb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/x86/xen/enlighten_pv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1259,10 +1259,6 @@ asmlinkage __visible void __init xen_start_kernel(void)
12591259
*/
12601260
__userpte_alloc_gfp &= ~__GFP_HIGHMEM;
12611261

1262-
/* Work out if we support NX */
1263-
get_cpu_cap(&boot_cpu_data);
1264-
x86_configure_nx();
1265-
12661262
/* Get mfn list */
12671263
xen_build_dynamic_phys_to_machine();
12681264

@@ -1272,6 +1268,10 @@ asmlinkage __visible void __init xen_start_kernel(void)
12721268
*/
12731269
xen_setup_gdt(0);
12741270

1271+
/* Work out if we support NX */
1272+
get_cpu_cap(&boot_cpu_data);
1273+
x86_configure_nx();
1274+
12751275
xen_init_irq_ops();
12761276

12771277
/* Let's presume PV guests always boot on vCPU with id 0. */

0 commit comments

Comments
 (0)