summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Cosgrove <tom@cvs.openbsd.org>2007-05-29 23:03:21 +0000
committerTom Cosgrove <tom@cvs.openbsd.org>2007-05-29 23:03:21 +0000
commit021ec44711c28964427ce40d104d204a5219286c (patch)
treec0bad2cd6e3fdd773509255d6646a8b8e66f458c
parent4142e42ef390d2ccf270d89472ed05cdc4bf3e18 (diff)
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