libc_r: map initial stack red zone with MAP_TRYFIXED
authorSimon Schubert <corecode@dragonflybsd.org>
Thu, 21 May 2009 20:43:56 +0000 (22:43 +0200)
committerSimon Schubert <corecode@dragonflybsd.org>
Fri, 22 May 2009 10:42:00 +0000 (12:42 +0200)
This is analogous to 9b505694017eeaf48fff9273f503160064583c14 and
2035b67992ac162a5968a22584ef29d2f53f93e2.

With-help-from: smtms, dillon

lib/libc_r/uthread/uthread_init.c

index 7b6bcea..562014a 100644 (file)
@@ -225,8 +225,8 @@ _thread_init(void)
                 * thread stack that is just beyond.
                 */
                if (mmap(_usrstack - PTHREAD_STACK_INITIAL -
-                   PTHREAD_STACK_GUARD, PTHREAD_STACK_GUARD, 0, MAP_ANON,
-                   -1, 0) == MAP_FAILED)
+                   PTHREAD_STACK_GUARD, PTHREAD_STACK_GUARD, 0,
+                   MAP_ANON | MAP_TRYFIXED, -1, 0) == MAP_FAILED)
                        PANIC("Cannot allocate red zone for initial thread");
 
                _thread_initial->tcb = tls_get_tcb();