DragonFly commits List (threaded) for 2009-04
DragonFly-18.104.22.1688.g2035b master lib/libthread_xu/thread thr_init.c thr_stack.c
Author: Matthew Dillon <firstname.lastname@example.org>
Date: Thu Apr 23 13:05:24 2009 -0700
Fix libthread_xu's use of MAP_STACK. Guards were not being setup properly.
MAP_STACK mappings do not immediately extend down to their base, so calling
mprotect() on the base is basically a NOP. Instead of calling mprotect() we
call mmap() with MAP_FIXED to force the guard.
Properly use MAP_FIXED when setting up the primary guard on the original
user stack. The address specified in the mmap() is only a hint when MAP_FIXED
is not used, and will not properly map the anonymous area. Also, new kernels
do not allow non-MAP_STACK mappings to override MAP_STACK mappings and the
user stack area is a MAP_STACK mapping, so use of MAP_FIXED is mandatory here.
Summary of changes:
lib/libthread_xu/thread/thr_init.c | 5 ++-
lib/libthread_xu/thread/thr_stack.c | 36 ++++++++++++++++++++++------------
2 files changed, 26 insertions(+), 15 deletions(-)
DragonFly BSD source repository