Module Name: src
Committed By: snj
Date: Thu Nov 2 21:39:18 UTC 2017
Modified Files:
src/sys/uvm [netbsd-8]: uvm_mmap.c
Log Message:
Pull up following revision(s) (requested by christos in ticket #336):
sys/uvm/uvm_mmap.c: revision 1.167
[syzkaller] Fix for PR #52658 as suggested by riastradh@
The bug was found by Dmitry Vyukov (dvyukov%google.com@localhost)
using syzkaller and was tested by me on a VM running
8.99.5
To generate a diff of this commit:
cvs rdiff -u -r1.166 -r1.166.2.1 src/sys/uvm/uvm_mmap.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/uvm/uvm_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.166 src/sys/uvm/uvm_mmap.c:1.166.2.1
--- src/sys/uvm/uvm_mmap.c:1.166 Sat May 20 07:27:15 2017
+++ src/sys/uvm/uvm_mmap.c Thu Nov 2 21:39:18 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_mmap.c,v 1.166 2017/05/20 07:27:15 chs Exp $ */
+/* $NetBSD: uvm_mmap.c,v 1.166.2.1 2017/11/02 21:39:18 snj Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.166 2017/05/20 07:27:15 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.166.2.1 2017/11/02 21:39:18 snj Exp $");
#include "opt_compat_netbsd.h"
#include "opt_pax.h"
@@ -398,10 +398,12 @@ sys_mmap(struct lwp *l, const struct sys
}
maxprot = PAX_MPROTECT_MAXPROTECT(l, prot, extraprot, maxprot);
- if (((prot | extraprot) & maxprot) != (prot | extraprot))
- return EACCES;
+ if (((prot | extraprot) & maxprot) != (prot | extraprot)) {
+ error = EACCES;
+ goto out;
+ }
if ((error = PAX_MPROTECT_VALIDATE(l, prot)))
- return error;
+ goto out;
pax_aslr_mmap(l, &addr, orig_addr, flags);