From 4ea9b9aca90cfc71e6872ed3522356755162932c Mon Sep 17 00:00:00 2001 From: Zhenzhong Duan Date: Fri, 29 Mar 2013 09:14:00 +0800 Subject: [PATCH] xen: mask x2APIC feature in PV On x2apic enabled pvm, doing sysrq+l, got NULL pointer dereference as below. SysRq : Show backtrace of all active CPUs BUG: unable to handle kernel NULL pointer dereference at (null) IP: [] memcpy+0xb/0x120 Call Trace: [] ? __x2apic_send_IPI_mask+0x73/0x160 [] x2apic_send_IPI_all+0x1e/0x20 [] arch_trigger_all_cpu_backtrace+0x6c/0xb0 [] ? _raw_spin_lock_irqsave+0x34/0x50 [] sysrq_handle_showallcpus+0xe/0x10 [] __handle_sysrq+0x7d/0x140 [] ? __handle_sysrq+0x140/0x140 [] write_sysrq_trigger+0x57/0x60 [] proc_reg_write+0x86/0xc0 [] vfs_write+0xce/0x190 [] sys_write+0x55/0x90 [] system_call_fastpath+0x16/0x1b That's because apic points to apic_x2apic_cluster or apic_x2apic_phys but the basic element like cpumask isn't initialized. Mask x2APIC feature in pvm to avoid overwrite of apic pointer, update commit message per Konrad's suggestion. Signed-off-by: Zhenzhong Duan Tested-by: Tamon Shiose Signed-off-by: Konrad Rzeszutek Wilk --- arch/x86/xen/enlighten.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 31e19f9..4bd0066 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -429,6 +429,9 @@ static void __init xen_init_cpuid_mask(void) cpuid_leaf1_edx_mask &= ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ (1 << X86_FEATURE_ACPI)); /* disable ACPI */ + + cpuid_leaf1_ecx_mask &= ~(1 << (X86_FEATURE_X2APIC % 32)); + ax = 1; cx = 0; xen_cpuid(&ax, &bx, &cx, &dx); -- 2.7.4