From: Kees Cook <kees.cook@canonical.com>
To: matthieu castet <castet.matthieu@free.fr>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: [BUG] broken ebba638ae723d8a8fc2f7abce5ec18b688b791d7
Date: Thu, 27 Jan 2011 15:00:13 -0800 [thread overview]
Message-ID: <20110127230013.GO4981@outflux.net> (raw)
In-Reply-To: <4D41E86D.8060205@free.fr>
Hi matthieu,
On Thu, Jan 27, 2011 at 10:49:33PM +0100, matthieu castet wrote:
> ebba638ae723d8a8fc2f7abce5ec18b688b791d7 x86, cpu: Call verify_cpu during 32bit CPU startup look buggy.
>
> It add a call to verify_cpu, but we never set the stack before (I check with qemu + gdbserver that sp is random
> when doing cpu hotplug).
> This mean do randomly corrupt the memory.
Yikes, good catch.
arch/x86/kernel/trampoline_64.S uses:
movw $(trampoline_stack_end - r_base), %sp
arch/x86/boot/compressed/head_64.S uses:
movl $boot_stack_end, %eax
addl %ebp, %eax
movl %eax, %esp
what would be safe for arch/x86/kernel/head_32.S ? It uses "stack_start",
but later after paging set-up. Is the following sane to solve this?
diff --git a/arch/x86/kernel/head_32.S b/arch/x86/kernel/head_32.S
index fc293dc..8ddd0e4 100644
--- a/arch/x86/kernel/head_32.S
+++ b/arch/x86/kernel/head_32.S
@@ -284,6 +284,8 @@ ENTRY(startup_32_smp)
movl %eax,%gs
#endif /* CONFIG_SMP */
default_entry:
+ /* Set up the stack pointer */
+ lss stack_start,%esp
/*
* New page tables may be in 4Mbyte page mode and may
@@ -347,8 +349,6 @@ default_entry:
movl %eax,%cr0 /* ..and set paging (PG) bit */
ljmp $__BOOT_CS,$1f /* Clear prefetch and normalize %eip */
1:
- /* Set up the stack pointer */
- lss stack_start,%esp
/*
* Initialize eflags. Some BIOS's leave bits like NT set. This would
-Kees
--
Kees Cook
Ubuntu Security Team
next prev parent reply other threads:[~2011-01-27 23:00 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 [this message]
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
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=20110127230013.GO4981@outflux.net \
--to=kees.cook@canonical.com \
--cc=castet.matthieu@free.fr \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®