Module Name:    src
Committed By:   reinoud
Date:           Tue Dec 20 19:49:36 UTC 2011

Modified Files:
        src/sys/uvm: uvm_mmap.c

Log Message:
If we need to set the PK_CHKNOSYSCALL flag in struct proc be so nice to first
take the mutex. Tnx for pointing it out to me.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 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.140 src/sys/uvm/uvm_mmap.c:1.141
--- src/sys/uvm/uvm_mmap.c:1.140	Tue Dec 20 15:39:35 2011
+++ src/sys/uvm/uvm_mmap.c	Tue Dec 20 19:49:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_mmap.c,v 1.140 2011/12/20 15:39:35 reinoud Exp $	*/
+/*	$NetBSD: uvm_mmap.c,v 1.141 2011/12/20 19:49:36 reinoud 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.140 2011/12/20 15:39:35 reinoud Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.141 2011/12/20 19:49:36 reinoud Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_pax.h"
@@ -560,8 +560,12 @@ sys_mmap(struct lwp *l, const struct sys
 				panic("uvm_setattr failed?");
 		}
 		/* record if we need optimization for system call checking */
-		if (flags & MAP_NOSYSCALLS)
+		if ((flags & MAP_NOSYSCALLS) &&
+				((p->p_flag & PK_CHKNOSYSCALL) == 0)) {
+			mutex_enter(p->p_lock);
 			p->p_flag |= PK_CHKNOSYSCALL;
+			mutex_exit(p->p_lock);
+		}
 	}
 
      	if (fp != NULL)

Reply via email to