Age | Commit message (Collapse) | Author | |
---|---|---|---|
2011-02-24 | linuxthreads.old: fix nommu initial thread stack detection | Mike Frysinger | |
Because the nommu address space is flat, and the application stack can literally be located anywhere, we cannot rely on the assumptions that the mmu port gets away with. Namely, that the first thread's stack lives at the top of memory and nothing will be created above it. Currently, the code rounds the current stack up a page and sets that as the "top" of the stack, and then marks the "bottom" of the stack as "1". Then as new threads are created, this assumption is further refined by slowly backing off the "bottom" when a new stack is created within the range of the initial stack. Simple ascii example (tid0 is the initial thread): 1 thread: [bos tid0 stack tos] 2 threads: [ tid0 stack ] [tid1 stack] 3 threads: [ tid0 stack ] [tid1 stack] [tid2 stack] As you can kind of see, this algorithm operates on one basic assumption: the initial top of stack calculation is the absolute top of the stack. While this assumption was fairly safe in the original nommu days of yore where the only file format was FLAT (which defaults to a 4KiB stack -- exactly 1 page), and memory was fairly tight, we can see that this falls apart pretty quickly as soon as the initial stack is larger than a page. The issue that crops up now is simple to hit: start an application with an 8KiB stack, execute some functions that put pressure on the stack so that it exceeds 4KiB, then start up some threads. The initial tos will be rounded up by a page, but this is actually the middle of the stack. Now when the initial thread returns from its functions (thus unwinding the stack) and tries to call something which calls back into libpthread, the thread_self() func fails to detect itself as the initial thread as the current stack is now above the tos. The __pthread_find_self() func kicks in, walks all the thread arrays, fails to find a hit, and then walks into uninitialized memory for the thread descriptor. Use of this garbage memory has obvious results -- things fall down & go boom. To address this, I extend the current algorithm to automatically scale back both the bottom and the top stack limits of the initial thread. We use the current stack pointer at "thread boot time" only as a single known point. The initial thread stack bottom is set to the bottom of memory and the initial thread stack top is set to the top of memory. Then as we create new stack threads, we figure out whether the new stack is above or below the single known good address, and then scale back either the tos or the bos accordingly. Reviewed-by: Steven J. Magnani <steve@digidescorp.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org> | |||
2009-07-21 | libpthread: add format attribute to __pthread_message() | Mike Frysinger | |
Signed-off-by: Mike Frysinger <vapier@gentoo.org> | |||
2008-12-10 | *: remove some __libc_XXX functions: | Denis Vlasenko | |
__libc_accept __libc_close __libc_connect __libc_creat __libc_creat64 __libc_fsync __libc_lseek __libc_lseek64 __libc_msync __libc_nanosleep __libc_open __libc_open64 __libc_pause __libc_read __libc_readv __libc_recv __libc_recvfrom __libc_recvmsg __libc_send __libc_sendmsg __libc_sendto __libc_tcdrain __libc_wait __libc_waitpid __libc_write __libc_writev They were removed from glibc 1 May 2004: http://sources.redhat.com/ml/libc-hacker/2004-05/msg00001.html | |||
2008-09-25 | Add globally __stringify macro in libc-symbols.h. | Carmelo Amoroso | |
Remove all other duplicated definitions. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com> | |||
2008-07-23 | - trim any trailing whitespace | Bernhard Reutner-Fischer | |
2008-07-23 | - fix inline keyword | Bernhard Reutner-Fischer | |
2006-11-09 | backport from upstream: | Mike Frysinger | |
2001-04-10 Ulrich Drepper <drepper@redhat.com> * join.c (pthread_exit): Move code to new function __pthread_do_exit which takes an extra parameter with the current frame pointer. Call new function with CURRENT_STACK_FRAME. (__pthread_do_exit): New function. Call __pthread_perform_cleanup with the new parameter. (pthread_join): Call __pthread_do_exit instead of pthread_exit. * cancel.c (__pthread_perform_cleanup): Takes extra parameter. Use this parameter as the initial value the cleanup handler records are compared against. No active cleanup handler record must have an address lower than the previous one and the initial record must be above (below on PA) the frame address passed in. (pthread_setcancelstate): Call __pthread_do_exit instead of pthread_exit. (pthread_setcanceltype): Likewise. (pthread_testcancel): Likewise. (_pthread_cleanup_pop_restore): Likewise. * condvar.c (pthread_cond_wait): Likewise. (pthread_cond_timedwait_relative): Likewise. * manager.c (pthread_start_thread): Likewise. * oldsemaphore.c (__old_sem_wait): Likewise. * pthread.c (pthread_handle_sigcancel): Likewise. * semaphore.c (__new_sem_wait): Likewise. (sem_timedwait): Likewise. * ptlongjmp.c (pthread_cleanup_upto): Also use current stack frame to limit the cleanup handlers which get run. * internals.h: Add prototype for __pthread_do_exit. Adjust prototype for __pthread_perform_cleanup. | |||
2006-11-09 | backport from upstream: | Mike Frysinger | |
2001-04-11 Ulrich Drepper <drepper@redhat.com> * cancel.c (_pthread_cleanup_push): Catch invalid __prev buffer and remove it. (_pthread_cleanup_push_defer): Likewise. | |||
2006-11-03 | remove duplicated/unused ASSERT code | Mike Frysinger | |
2006-02-18 | tweak the idea between having a MMU and actually using it | Mike Frysinger | |
2006-02-01 | typo | Peter S. Mazinger | |
2006-02-01 | same in old | Peter S. Mazinger | |
2006-01-26 | Get rid of missing prototype warnings | Peter S. Mazinger | |
2006-01-25 | Modify the earlier changes, because libc-lock references __pthread_mutex*, ↵ | Peter S. Mazinger | |
dont use hidden_strong_alias | |||
2006-01-25 | Remove unused prototype | Peter S. Mazinger | |
2006-01-24 | Get rid of a shadow warning | Peter S. Mazinger | |
2006-01-24 | waitpid undefined | Peter S. Mazinger | |
2006-01-24 | use __typeof for all __libc_x prototypes, do not need __sigaction/__vfork | Peter S. Mazinger | |
2006-01-23 | Make i386 build w/ -std=c99 (almost) | Peter S. Mazinger | |
2006-01-04 | update pthread weak handling to the style glibc uses | Mike Frysinger | |
2005-11-15 | rename current stable linuxthreads to linuxthreads.old to prepare for import ↵ | Mike Frysinger | |
of latest glibc version |