summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2020-10-04 21:58:53 +0000
committerderaadt <deraadt@openbsd.org>2020-10-04 21:58:53 +0000
commitc37ebb0f2d42c8d3dcd63e58253f5c9e8bd32c0c (patch)
tree42ff49be7d08dc751e1e57315fbe5e1a506087f1
parentChange kcopy(9) such that it does 64-bit and 32-bit copies whenever possible. (diff)
downloadwireguard-openbsd-c37ebb0f2d42c8d3dcd63e58253f5c9e8bd32c0c.tar.xz
wireguard-openbsd-c37ebb0f2d42c8d3dcd63e58253f5c9e8bd32c0c.zip
Recent changes for PROT_NONE pages to not count against resource limits,
failed to note this also guarded against heavy amap allocations in the MAP_SHARED case. Bring back the checks for MAP_SHARED from semarie, ok kettenis https://syzkaller.appspot.com/bug?extid=d80de26a8db6c009d060
-rw-r--r--sys/uvm/uvm_mmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/uvm/uvm_mmap.c b/sys/uvm/uvm_mmap.c
index 29d79afb103..f08e9fc3b84 100644
--- a/sys/uvm/uvm_mmap.c
+++ b/sys/uvm/uvm_mmap.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_mmap.c,v 1.161 2020/03/04 21:15:39 kettenis Exp $ */
+/* $OpenBSD: uvm_mmap.c,v 1.162 2020/10/04 21:58:53 deraadt Exp $ */
/* $NetBSD: uvm_mmap.c,v 1.49 2001/02/18 21:19:08 chs Exp $ */
/*
@@ -404,7 +404,7 @@ is_anon: /* label for SunOS style /dev/zero */
if ((flags & __MAP_NOFAULT) != 0)
return EINVAL;
- if (prot != PROT_NONE) {
+ if (prot != PROT_NONE || (flags & MAP_SHARED)) {
limit = lim_cur(RLIMIT_DATA);
if (limit < size ||
limit - size < ptoa(p->p_vmspace->vm_dused)) {