summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2006-02-24 22:03:10 +0000
committerdeischen <deischen@FreeBSD.org>2006-02-24 22:03:10 +0000
commit2c3357a0a6aa69c1b9e08ef6a1fd02ac37e41217 (patch)
tree3439df061340ff5af46f8ff57b9e96d3657ad768 /lib/libpthread
parente93973003073f1a6c0f27920ffd1b2e8de1a4742 (diff)
downloadFreeBSD-src-2c3357a0a6aa69c1b9e08ef6a1fd02ac37e41217.zip
FreeBSD-src-2c3357a0a6aa69c1b9e08ef6a1fd02ac37e41217.tar.gz
Fix a race condition introduced when redzones were added. Use an
atomic operation to return and adjust the stack. Submitted by: luoqi
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/arch/amd64/amd64/context.S9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libpthread/arch/amd64/amd64/context.S b/lib/libpthread/arch/amd64/amd64/context.S
index 9e6ed74..6a6b558 100644
--- a/lib/libpthread/arch/amd64/amd64/context.S
+++ b/lib/libpthread/arch/amd64/amd64/context.S
@@ -162,11 +162,11 @@ ENTRY(_amd64_restore_context)
cmpq $0, %rdi /* check for null pointer */
jne 1f
movq $-1, %rax
- jmp 7f
+ jmp 2f
1: cmpq $MC_SIZE, MC_LEN_OFFSET(%rdi) /* is context valid? */
je 2f
movq $-1, %rax /* bzzzt, invalid context */
- jmp 7f
+ ret
2: movq MC_RCX(%rdi), %rcx
movq MC_R8(%rdi), %r8
movq MC_R9(%rdi), %r9
@@ -213,6 +213,5 @@ ENTRY(_amd64_restore_context)
popq %rsi /* restore rsi, rdx, and rdi */
popq %rdx
popq %rdi
- leaq (8 + REDZONE)(%rsp), %rsp
- jmp *-(8 + REDZONE)(%rsp) /* jump to return address */
-7: ret
+ ret $REDZONE
+
OpenPOWER on IntegriCloud