git: 9dbf67a7948d - stable/14 - kern/sys_process.c: make vmspace_rwmem() similar to io functions
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 09 Oct 2026 02:22:15 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=9dbf67a7948d7ba6bc8baa6d59a30aa2dc75f564
commit 9dbf67a7948d7ba6bc8baa6d59a30aa2dc75f564
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-08-14 05:46:07 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-09 02:21:04 +0000
kern/sys_process.c: make vmspace_rwmem() similar to io functions
PR: 297512
(cherry picked from commit 1a71d24ecd0dbaf61fd2a44166e9be07c328b198)
---
sys/kern/sys_process.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sys/kern/sys_process.c b/sys/kern/sys_process.c
index def87f8a1cd5..ab9aa519046e 100644
--- a/sys/kern/sys_process.c
+++ b/sys/kern/sys_process.c
@@ -430,6 +430,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;
@@ -443,6 +444,8 @@ 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;
+
/*
* Only map in one page at a time. We don't have to, but it
* makes things easier. This way is trivial - right?
@@ -497,8 +500,8 @@ vmspace_rwmem(struct vmspace *vm, struct uio *uio)
vm_page_unwire(m, PQ_ACTIVE);
} while (error == 0 && uio->uio_resid > 0);
+ return (uio->uio_resid == orig_resid ? error : 0);
- return (error);
}
int