[coreboot] New patch to review for coreboot: 4715d6b Poison the stack to uncover programming errors
Ronald G. Minnich (rminnich@gmail.com)
gerrit at coreboot.org
Thu Jul 12 20:24:34 CEST 2012
Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1221
-gerrit
commit 4715d6b4706fb78e9073295b878b69a6cf37ab6f
Author: Ronald G. Minnich <rminnich at gmail.com>
Date: Thu Jul 12 11:21:51 2012 -0700
Poison the stack to uncover programming errors
Code can easily make the mistake of using uninitialized
values or, in assembly, mistakenly dereferencing stack pointers
when an address is desired.
Set the stack to a non-zero value which is also (by testing)
a pointer which will crash coreboot if used. This poisoning
has uncovered at least one bug.
Change-Id: I4affb9a14b96611e8bf83cb82636e47913025a5d
Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
src/arch/x86/lib/c_start.S | 10 +++++++---
1 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/arch/x86/lib/c_start.S b/src/arch/x86/lib/c_start.S
index fd9dce7..9c1fdb1 100644
--- a/src/arch/x86/lib/c_start.S
+++ b/src/arch/x86/lib/c_start.S
@@ -16,17 +16,21 @@ _start:
post_code(POST_ENTRY_C_START) /* post 13 */
- /** clear stack */
+ /** poison the stack. Code should not count on the
+ * stack being full of zeros. This stack poisoning
+ * recently uncovered a bug in the broadcast SIPI
+ * code.
+ */
cld
leal _stack, %edi
movl $_estack, %ecx
subl %edi, %ecx
shrl $2, %ecx /* it is 32 bit aligned, right? */
- xorl %eax, %eax
+ movl $0xDEADBEEF, %eax
rep
stosl
- /** clear bss */
+ /** clear bss, which unlike the stack is zero by definition */
leal _bss, %edi
movl $_ebss, %ecx
subl %edi, %ecx
More information about the coreboot
mailing list