diff options
author | deischen <deischen@FreeBSD.org> | 2006-02-24 22:03:10 +0000 |
---|---|---|
committer | deischen <deischen@FreeBSD.org> | 2006-02-24 22:03:10 +0000 |
commit | 2c3357a0a6aa69c1b9e08ef6a1fd02ac37e41217 (patch) | |
tree | 3439df061340ff5af46f8ff57b9e96d3657ad768 /lib/libkse/arch | |
parent | e93973003073f1a6c0f27920ffd1b2e8de1a4742 (diff) | |
download | FreeBSD-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/libkse/arch')
-rw-r--r-- | lib/libkse/arch/amd64/amd64/context.S | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/libkse/arch/amd64/amd64/context.S b/lib/libkse/arch/amd64/amd64/context.S index 9e6ed74..6a6b558 100644 --- a/lib/libkse/arch/amd64/amd64/context.S +++ b/lib/libkse/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 + |