Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/uvm [syzkaller] Fix for PR #52658 as suggested by riastr...



details:   https://anonhg.NetBSD.org/src/rev/491acda68e1c
branches:  trunk
changeset: 827416:491acda68e1c
user:      utkarsh009 <utkarsh009%NetBSD.org@localhost>
date:      Fri Oct 27 12:01:08 2017 +0000

description:
[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

diffstat:

 sys/uvm/uvm_mmap.c |  12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diffs (34 lines):

diff -r de881415f0c3 -r 491acda68e1c sys/uvm/uvm_mmap.c
--- a/sys/uvm/uvm_mmap.c        Fri Oct 27 11:15:03 2017 +0000
+++ b/sys/uvm/uvm_mmap.c        Fri Oct 27 12:01:08 2017 +0000
@@ -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.167 2017/10/27 12:01:08 utkarsh009 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.167 2017/10/27 12:01:08 utkarsh009 Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -398,10 +398,12 @@
        }
 
        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);
 



Home | Main Index | Thread Index | Old Index