Messages in this thread Patch in this message | | | Date | Thu, 03 Feb 2011 21:47:58 -0800 | From | "H. Peter Anvin" <> | Subject | Re: [BUG] broken ebba638ae723d8a8fc2f7abce5ec18b688b791d7 |
| |
On 02/02/2011 12:40 PM, Kees Cook wrote: > On Mon, Jan 31, 2011 at 05:10:03PM -0800, H. Peter Anvin wrote: >> On 01/31/2011 03:52 PM, Kees Cook wrote: >>> >>> This worked, thanks! If this tests cleanly for you in qemu, we should get >>> this committed. >>> >> >> This is wrong for at least one reason; possibly two: >> >> a) it ignores the control to not reload the segment registers (not >> sure if anything still uses them, but...) >> >> b) I'm not sure that init_thread_union is safe for the non-BSP CPU here. > > What's the best way to move forward? Or, how can we find answers to these > questions? > > -Kees >
Can someone test out the attached patch and verify that it works?
-hpa
-- H. Peter Anvin, Intel Open Source Technology Center I work for Intel. I don't speak on their behalf.
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S index fc293dc..2aee594 100644 --- a/arch/x86/kernel/head_32.S +++ b/arch/x86/kernel/head_32.S @@ -26,6 +26,11 @@ #define pa(X) ((X) - __PAGE_OFFSET) /* + * Initial stack pointer for the boot processor + */ +initial_stack_pointer = init_thread_union+THREAD_SIZE + +/* * References to members of the new_cpu_data structure. */ @@ -99,8 +104,10 @@ ENTRY(startup_32) movl %eax,%es movl %eax,%fs movl %eax,%gs + movl %eax,%ss 2: - + movl $pa(initial_stack_pointer), %esp + /* * Clear BSS first so that there are no surprises... */ @@ -282,6 +289,9 @@ ENTRY(startup_32_smp) movl %eax,%es movl %eax,%fs movl %eax,%gs + movl pa(stack_start),%ecx + movl %eax,%ss + leal -__PAGE_OFFSET(%ecx),%esp #endif /* CONFIG_SMP */ default_entry: @@ -671,7 +681,7 @@ ENTRY(initial_page_table) .data ENTRY(stack_start) - .long init_thread_union+THREAD_SIZE + .long initial_stack_pointer .long __BOOT_DS ready: .byte 0 | |