Source-Changes-HG archive

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

[src/trunk]: src/lib/libpthread only mprotect base if we moved it.



details:   https://anonhg.NetBSD.org/src/rev/5996f35367f1
branches:  trunk
changeset: 759988:5996f35367f1
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Dec 22 22:19:46 2010 +0000

description:
only mprotect base if we moved it.

diffstat:

 lib/libpthread/pthread.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r 57588ebcdb8f -r 5996f35367f1 lib/libpthread/pthread.c
--- a/lib/libpthread/pthread.c  Wed Dec 22 22:08:47 2010 +0000
+++ b/lib/libpthread/pthread.c  Wed Dec 22 22:19:46 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pthread.c,v 1.118 2010/12/18 15:54:27 christos Exp $   */
+/*     $NetBSD: pthread.c,v 1.119 2010/12/22 22:19:46 christos Exp $   */
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread.c,v 1.118 2010/12/18 15:54:27 christos Exp $");
+__RCSID("$NetBSD: pthread.c,v 1.119 2010/12/22 22:19:46 christos Exp $");
 
 #define        __EXPOSE_STACK  1
 
@@ -1227,10 +1227,10 @@
                pthread__mainbase = (vaddr_t)base;
                base = STACK_GROW(base, pthread__stacksize);
                pthread__mainstruct = (vaddr_t)base;
+               if (mprotect(base, size, PROT_READ|PROT_WRITE) == -1)
+                       err(1, "mprotect stack");
        }
        size = pthread__stacksize;
-       if (mprotect(base, size, PROT_READ|PROT_WRITE) == -1)
-               err(1, "mprotect stack");
 
        error = pthread__stackid_setup(base, size, &t);
        if (error) {



Home | Main Index | Thread Index | Old Index