LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Kees Cook <kees.cook@canonical.com>
Cc: matthieu castet <castet.matthieu@free.fr>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Ingo Molnar <mingo@elte.hu>,
	Jeremy Fitzhardinge <jeremy@goop.org>
Subject: Re: [BUG] broken ebba638ae723d8a8fc2f7abce5ec18b688b791d7
Date: Thu, 03 Feb 2011 21:47:58 -0800	[thread overview]
Message-ID: <4D4B930E.1060704@zytor.com> (raw)
In-Reply-To: <20110202204031.GB5503@outflux.net>

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

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.


[-- Attachment #2: diff --]
[-- Type: text/plain, Size: 1005 bytes --]

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

  reply	other threads:[~2011-02-04  5:48 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-27 21:49 matthieu castet
2011-01-27 23:00 ` Kees Cook
2011-01-28  2:24   ` H. Peter Anvin
2011-01-28  3:38     ` H. Peter Anvin
2011-01-28 16:58       ` Jeremy Fitzhardinge
2011-02-02 22:48         ` H. Peter Anvin
2011-02-03  1:19           ` Rusty Russell
2011-02-03  2:00             ` Rusty Russell
2011-02-03  2:35               ` H. Peter Anvin
2011-02-03 10:02                 ` Rusty Russell
2011-02-03 17:11                   ` H. Peter Anvin
2011-01-31 21:38     ` Kees Cook
2011-01-31 23:11       ` matthieu castet
2011-01-31 23:17         ` Rafael J. Wysocki
2011-02-01 13:07           ` castet.matthieu
2011-02-01 18:50             ` Rafael J. Wysocki
2011-01-31 23:52         ` Kees Cook
2011-02-01  1:10           ` H. Peter Anvin
2011-02-02 20:40             ` Kees Cook
2011-02-04  5:47               ` H. Peter Anvin [this message]
2011-01-31 23:12       ` matthieu castet
2011-02-05  0:34 ` [tip:x86/urgent] x86-32: Make sure the stack is set up before we use it tip-bot for H. Peter Anvin
2011-02-05  0:45 ` tip-bot for H. Peter Anvin
2011-02-05  2:19   ` Kees Cook
2011-02-05  4:37     ` H. Peter Anvin
2011-02-05  5:37       ` Kees Cook
2011-02-05  6:26         ` H. Peter Anvin
2011-02-05  6:31 ` tip-bot for H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D4B930E.1060704@zytor.com \
    --to=hpa@zytor.com \
    --cc=castet.matthieu@free.fr \
    --cc=jeremy@goop.org \
    --cc=kees.cook@canonical.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --subject='Re: [BUG] broken ebba638ae723d8a8fc2f7abce5ec18b688b791d7' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).