summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua M. Clulow <jmc@joyent.com>2013-01-10 22:03:52 +0000
committerJoshua M. Clulow <jmc@joyent.com>2013-01-10 22:34:45 +0000
commit2d69bb42a6f21808dbe14d78ee609773622e989e (patch)
tree300b2d3a49c1eb1df2a961e66f08cdb188470917
parentc246eda8e7ab4268e1774123454e9b3132863115 (diff)
downloadillumos-joyent-2d69bb42a6f21808dbe14d78ee609773622e989e.tar.gz
OS-1804 agent lwp clobbers amd64 abi stack redzone20130110release-20130110
Reviewed by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/lib/libproc/common/Psyscall.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/usr/src/lib/libproc/common/Psyscall.c b/usr/src/lib/libproc/common/Psyscall.c
index 1261eb49b4..a6cc285251 100644
--- a/usr/src/lib/libproc/common/Psyscall.c
+++ b/usr/src/lib/libproc/common/Psyscall.c
@@ -22,8 +22,9 @@
* Copyright 2006 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
-
-#pragma ident "%Z%%M% %I% %E% SMI"
+/*
+ * Copyright (c) 2013, Joyent Inc. All rights reserved.
+ */
#include <stdio.h>
#include <stdlib.h>
@@ -352,6 +353,16 @@ Psyscall(struct ps_prochandle *P,
#ifdef _LP64
if (model == PR_MODEL_LP64) {
sp = P->status.pr_lwp.pr_reg[R_SP] + STACK_BIAS;
+#if defined(__amd64)
+ /*
+ * To offset the expense of computerised subtraction, the AMD64
+ * ABI allows a process the use of a 128-byte area beyond the
+ * location pointed to by %rsp. We must advance the agent's
+ * stack pointer by at least the size of this region or else it
+ * may corrupt this temporary storage.
+ */
+ sp -= STACK_RESERVE64;
+#endif
sp = PSTACK_ALIGN64(sp);
} else {
#endif