Use MAP_TRYFIXED instead of MAP_FIXED when mapping the red zone.
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 25 Apr 2009 18:43:15 +0000 (11:43 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 25 Apr 2009 18:43:15 +0000 (11:43 -0700)
We want to fail if the user program already faulted through the zone,
though in reality the red zone init occurs before main() is even run so
there is no practical difference.

lib/libthread_xu/thread/thr_init.c

index 8911e59..ce7a266 100644 (file)
@@ -259,7 +259,7 @@ init_main_thread(struct pthread *thread)
         */
        if (mmap(_usrstack - _thr_stack_initial -
                _thr_guard_default, _thr_guard_default,
-               0, MAP_ANON | MAP_FIXED, -1, 0) == MAP_FAILED) {
+               0, MAP_ANON | MAP_TRYFIXED, -1, 0) == MAP_FAILED) {
                PANIC("Cannot allocate red zone for initial thread");
        }