summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@cvs.openbsd.org>2011-07-23 21:41:20 +0000
committerMark Kettenis <kettenis@cvs.openbsd.org>2011-07-23 21:41:20 +0000
commit67c13516c5e5c91aa0473d731803fbc1095f4b5f (patch)
treeff3473d14451f60f54ea301ff3b09066520ef241
parentcc9434d271301c2b8698ff09092d9be6a1d1c2fc (diff)
Properly align the stack early on in the ld.so startup code such that code run
from .init that uses SSE doesn't randomly trigger SIGBUS. ok drahn@, miod@
-rw-r--r--libexec/ld.so/amd64/ldasm.S7
1 files changed, 6 insertions, 1 deletions
diff --git a/libexec/ld.so/amd64/ldasm.S b/libexec/ld.so/amd64/ldasm.S
index 4e9ed24f1c5..0ffe3a600eb 100644
--- a/libexec/ld.so/amd64/ldasm.S
+++ b/libexec/ld.so/amd64/ldasm.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: ldasm.S,v 1.7 2010/05/11 16:27:14 guenther Exp $ */
+/* $OpenBSD: ldasm.S,v 1.8 2011/07/23 21:41:19 kettenis Exp $ */
/*
* Copyright (c) 2002,2004 Dale Rahn
@@ -39,6 +39,11 @@
.type _dl_start,@function
_dl_start:
movq %rsp, %r12 # save stack pointer for _rtld
+
+ subq $8, %rsp # align stack
+ andq $~15, %rsp
+ addq $8, %rsp
+
pushq %rbx # save ps_strings
subq $DL_DATA_SIZE, %rsp # allocate dl_data