summaryrefslogtreecommitdiffstats
path: root/sys/amd64/amd64/exception.S
diff options
context:
space:
mode:
authorkib <kib@FreeBSD.org>2011-04-08 21:26:50 +0000
committerkib <kib@FreeBSD.org>2011-04-08 21:26:50 +0000
commitdae91cc1408e54eaebf0fd410992b3a0d7d26d5a (patch)
treec0a6c16dd23cf8037179bc2b4f23fcb95e27da03 /sys/amd64/amd64/exception.S
parent096c7a804fc82a151f8b7d1a6811fd08aa223699 (diff)
downloadFreeBSD-src-dae91cc1408e54eaebf0fd410992b3a0d7d26d5a.zip
FreeBSD-src-dae91cc1408e54eaebf0fd410992b3a0d7d26d5a.tar.gz
Disable local interrupts before testing the PCB_FULL_IRET flag.
Thread might be preempted after testing, which causes the flag to be cleared. If ast was not delivered, we will do sysret with potentially wrong fs/gs bases. Reviewed by: jhb, jkim MFC after: 1 week (together with r220430, r220452)
Diffstat (limited to 'sys/amd64/amd64/exception.S')
-rw-r--r--sys/amd64/amd64/exception.S3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/amd64/amd64/exception.S b/sys/amd64/amd64/exception.S
index 65515aa..c537a4f 100644
--- a/sys/amd64/amd64/exception.S
+++ b/sys/amd64/amd64/exception.S
@@ -383,10 +383,11 @@ IDTVEC(fast_syscall)
movq %rsp,%rdi
call syscall
1: movq PCPU(CURPCB),%rax
+ /* Disable interrupts before testing PCB_FULL_IRET. */
+ cli
testl $PCB_FULL_IRET,PCB_FLAGS(%rax)
jnz 3f
/* Check for and handle AST's on return to userland. */
- cli
movq PCPU(CURTHREAD),%rax
testl $TDF_ASTPENDING | TDF_NEEDRESCHED,TD_FLAGS(%rax)
je 2f
OpenPOWER on IntegriCloud