Skip to contentSkip to conversation

VMI fix for stack protector

PATCH Alok Kataria 1 participant 2 messages Aug 4, 2009 – Aug 5, 2009 x86

lore
Share & tools
lore
#0 lore raw

With CONFIG_STACK_PROTECTOR turned on, VMI doesn't boot with more than one processor. The problem is with the gs value not being initialized correctly when registering the secondary processor for VMI's case.

The patch below initializes the gs value for the AP to __KERNEL_STACK_CANARY. Without this the secondary processor keeps on taking a GP on every gs access.

Needs to go in for 2.6.30.x too, since STACK_PROTECTOR for 32bit was introduced in 2.6.30.

Patch on top of 2.6.31-rc5.

arch/x86/kernel/vmi_32.c +1 -1
Index: linux-2.6/arch/x86/kernel/vmi_32.c
===================================================================
@@ -442,7 +442,7 @@ vmi_startup_ipi_hook(int phys_apicid, un
 	ap.ds = __USER_DS;
 	ap.es = __USER_DS;
 	ap.fs = __KERNEL_PERCPU;
-	ap.gs = 0;
+	ap.gs = __KERNEL_STACK_CANARY;
 
 	ap.eflags = 0;
 
#1 lore raw

[tip:x86/urgent] x86: Fix VMI && stack protector

Commit-ID:  7d5b005652bc5ae3e1e0efc53fd0e25a643ec506
Gitweb:     http://git.kernel.org/tip/7d5b005652bc5ae3e1e0efc53fd0e25a643ec506
Author:     Alok Kataria <[email protected]>
AuthorDate: Tue, 4 Aug 2009 15:34:22 -0700
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 5 Aug 2009 10:20:29 +0200

x86: Fix VMI && stack protector

With CONFIG_STACK_PROTECTOR turned on, VMI doesn't boot with more than one processor. The problem is with the gs value not being initialized correctly when registering the secondary processor for VMI's case.

The patch below initializes the gs value for the AP to __KERNEL_STACK_CANARY. Without this the secondary processor keeps on taking a GP on every gs access.

LKML-Reference: <[email protected]>

---
 arch/x86/kernel/vmi_32.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/kernel/vmi_32.c +1 -1
index b263423..95a7289 100644
@@ -441,7 +441,7 @@ vmi_startup_ipi_hook(int phys_apicid, unsigned long start_eip,
 	ap.ds = __USER_DS;
 	ap.es = __USER_DS;
 	ap.fs = __KERNEL_PERCPU;
-	ap.gs = 0;
+	ap.gs = __KERNEL_STACK_CANARY;
 
 	ap.eflags = 0;