git: 42094ab41e5a - stable/15 - linux: correct errors from mremap(2)
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 31 Oct 2026 03:18:50 UTC
The branch stable/15 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=42094ab41e5ad34b56603fa343ba53f93c7f4984
commit 42094ab41e5ad34b56603fa343ba53f93c7f4984
Author: Joy <amutu@amutu.com>
AuthorDate: 2026-10-24 02:22:29 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-10-31 03:15:21 +0000
linux: correct errors from mremap(2)
PR: 299835
(cherry picked from commit 9a8d5af1ba0174ec5fcc3eedba545aec9a627987)
---
sys/compat/linux/linux_misc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index de40449e6f15..604453e48285 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -62,6 +62,7 @@
#include <security/mac/mac_framework.h>
#include <vm/pmap.h>
+#include <vm/vm_extern.h>
#include <vm/vm_map.h>
#include <vm/swap_pager.h>
@@ -325,7 +326,10 @@ linux_mremap(struct thread *td, struct linux_mremap_args *args)
if (args->new_len > args->old_len) {
td->td_retval[0] = 0;
- return (ENOMEM);
+ if (useracc((void *)(uintptr_t)args->addr, args->old_len,
+ VM_PROT_READ))
+ return (ENOMEM);
+ return (EFAULT);
}
if (args->new_len < args->old_len) {