From 2ff285bf2eda9011bb336ff3c279be9c8adcdd41 Mon Sep 17 00:00:00 2001 From: David Xu Date: Tue, 15 Jun 2004 21:46:36 +0000 Subject: [PATCH] Avoid to touch red zone, in libpthread, ucontext may be saved by kernel's get_mcontext, and libpthread will use signalcontext to deliver signal in userland, it looks same as kernel's send_sig does. Reviewed by: deischen, tjr --- lib/libc/amd64/gen/signalcontext.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/libc/amd64/gen/signalcontext.c b/lib/libc/amd64/gen/signalcontext.c index 4eb1919c4cc..e24f6cb325d 100644 --- a/lib/libc/amd64/gen/signalcontext.c +++ b/lib/libc/amd64/gen/signalcontext.c @@ -58,7 +58,7 @@ __signalcontext(ucontext_t *ucp, int sig, __sighandler_t *func) * This means that we need an 8-byte-odd alignment since the ABI expects * the return address to be pushed, thus breaking the 16 byte alignment. */ - sp = (ucp->uc_mcontext.mc_rsp - sizeof(ucontext_t)) & ~15UL; + sp = (ucp->uc_mcontext.mc_rsp - 128 - sizeof(ucontext_t)) & ~15UL; sig_uc = (ucontext_t *)sp; bcopy(ucp, sig_uc, sizeof(*sig_uc)); sp = (sp - sizeof(siginfo_t)) & ~15UL;