HomeFreeBSD

riscv: fix VM_MAXUSER_ADDRESS checks in asm routines

Description

riscv: fix VM_MAXUSER_ADDRESS checks in asm routines

There are two issues with the checks against VM_MAXUSER_ADDRESS. First,
the comparison should consider the values as unsigned, otherwise
addresses with the high bit set will fail to branch. Second, the value
of VM_MAXUSER_ADDRESS is, by convention, one larger than the maximum
mappable user address and invalid itself. Thus, use the bgeu instruction
for these comparisons.

Add a regression test case for copyin(9).

PR: 257193
Reported by: Robert Morris <rtm@lcs.mit.edu>
Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D31209

(cherry picked from commit 8babb5582eed2250309084d76898798409a2aae0)

Details

Provenance
mhorneAuthored on Oct 7 2021, 9:12 PM
Reviewer
markj
Differential Revision
D31209: riscv: fix VM_MAXUSER_ADDRESS checks in asm routines
Parents
rG43f5da70cc96: riscv: handle page faults in the unmappable region
Branches
Unknown
Tags
Unknown