git: 75bf78a0ed8d - stable/15 - kern/sys_process.c: make vmspace_rwmem() similar to io functions
Konstantin Belousov <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.src |
|---|---|
| Message-ID | <6a812484.44327.2c3b029c__19185.5505037651$1786848482$gmane$org@gitrepo.freebsd.org> |
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=75bf78a0ed8d3e108532c8893f5dad8bdb2b0b3e commit 75bf78a0ed8d3e108532c8893f5dad8bdb2b0b3e Author: Konstantin Belousov <[email protected]> AuthorDate: 2026-08-14 05:46:07 +0000 Commit: Konstantin Belousov <[email protected]> CommitDate: 2026-08-16 02:41:19 +0000 kern/sys_process.c: make vmspace_rwmem() similar to io functions PR: 297512 (cherry picked from commit 1a71d24ecd0dbaf61fd2a44166e9be07c328b198) --- sys/kern/sys_process.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c index 9ba8ec33e5dc..a365f833b2af 100644 --- a/sys/kern/sys_process.c +++ b/sys/kern/sys_process.c @@ -418,6 +418,7 @@ vmspace_rwmem(struct vmspace *vm, struct uio *uio) vm_map_t map; vm_offset_t pageno; /* page number */ vm_prot_t reqprot; + ssize_t orig_resid; int error, fault_flags, page_offset, writing; map = &vm->vm_map; @@ -431,10 +432,12 @@ vmspace_rwmem(struct vmspace *vm, struct uio *uio) reqprot = writing ? VM_PROT_COPY | VM_PROT_READ : VM_PROT_READ; fault_flags = writing ? VM_FAULT_DIRTY : VM_FAULT_NORMAL; + orig_resid = uio->uio_resid; + if (writing) { error = priv_check(curthread, PRIV_PROC_MEM_WRITE); if (error != 0) - goto out; + return (error); } /* @@ -491,9 +494,7 @@ vmspace_rwmem(struct vmspace *vm, struct uio *uio) vm_page_unwire(m, PQ_ACTIVE); } while (error == 0 && uio->uio_resid > 0); - -out: - return (error); + return (uio->uio_resid == orig_resid ? error : 0); } int