summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortom <tom@openbsd.org>2007-05-29 23:03:20 +0000
committertom <tom@openbsd.org>2007-05-29 23:03:20 +0000
commit8f6cca526d5ce208ff48842693f3b10bf9544acb (patch)
treee751073da79c8bf51c1ef7e678deff75ade1bcc5
parentImprove copyinstr and copyoutstr by performing the check against (diff)
downloadwireguard-openbsd-8f6cca526d5ce208ff48842693f3b10bf9544acb.tar.xz
wireguard-openbsd-8f6cca526d5ce208ff48842693f3b10bf9544acb.zip
Improve copyinstr and copyoutstr by erroring out when the userland
pointer is VM_MAXUSER_ADDRESS right up front, rather than when startig the loop. This is how it is done on i386. ok weingart@ art@
-rw-r--r--sys/arch/amd64/amd64/copy.S6
1 files changed, 3 insertions, 3 deletions
diff --git a/sys/arch/amd64/amd64/copy.S b/sys/arch/amd64/amd64/copy.S
index baf97d74fd1..042e8112fac 100644
--- a/sys/arch/amd64/amd64/copy.S
+++ b/sys/arch/amd64/amd64/copy.S
@@ -1,4 +1,4 @@
-/* $OpenBSD: copy.S,v 1.2 2005/03/16 07:08:38 tedu Exp $ */
+/* $OpenBSD: copy.S,v 1.3 2007/05/29 23:03:20 tom Exp $ */
/* $NetBSD: copy.S,v 1.1 2003/04/26 18:39:26 fvdl Exp $ */
/*
@@ -207,7 +207,7 @@ ENTRY(copyoutstr)
*/
movq $VM_MAXUSER_ADDRESS,%rax
subq %rdi,%rax
- jc _C_LABEL(copystr_efault)
+ jbe _C_LABEL(copystr_efault) /* die if CF == 1 || ZF == 1 */
cmpq %rdx,%rax
jae 1f
movq %rax,%rdx
@@ -249,7 +249,7 @@ ENTRY(copyinstr)
*/
movq $VM_MAXUSER_ADDRESS,%rax
subq %rsi,%rax
- jc _C_LABEL(copystr_efault)
+ jbe _C_LABEL(copystr_efault) /* die if CF == 1 || ZF == 1 */
cmpq %rdx,%rax
jae 1f
movq %rax,%rdx