Author: br
Date: Wed Sep  5 09:53:55 2018
New Revision: 338466
URL: https://svnweb.freebsd.org/changeset/base/338466

Log:
  Fix bug: compare uaddr to VM_MAXUSER_ADDRESS, not to a tmp value
  left by SET_FAULT_HANDLER().
  
  Approved by:  re (kib)
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/riscv/riscv/copyinout.S

Modified: head/sys/riscv/riscv/copyinout.S
==============================================================================
--- head/sys/riscv/riscv/copyinout.S    Wed Sep  5 01:46:27 2018        
(r338465)
+++ head/sys/riscv/riscv/copyinout.S    Wed Sep  5 09:53:55 2018        
(r338466)
@@ -111,12 +111,12 @@ END(copyin)
 ENTRY(copyinstr)
        mv      a5, x0          /* count = 0 */
        beqz    a2, 3f          /* If len == 0 then skip loop */
-       li      a7, VM_MAXUSER_ADDRESS
 
        la      a6, copyio_fault /* Get the handler address */
        SET_FAULT_HANDLER(a6, a7) /* Set the handler */
 
-1:     bgt     a7, a0, copyio_fault
+       li      a7, VM_MAXUSER_ADDRESS
+1:     bgt     a0, a7, copyio_fault
        lb      a4, 0(a0)       /* Load from uaddr */
        addi    a0, a0, 1
        sb      a4, 0(a1)       /* Store in kaddr */
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to