From 021fb898d39a01bd15b3131678eb0dcf15cceaad Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 16 Sep 2005 04:58:13 +0000 Subject: Robin Getz from blackfin.uclinux.org writes: Bernd Schmidt found/fixed this problem in uClibc: http://blackfin.uclinux.org/tracker/index.php?func=detail&aid=882&group_id=17&atid=141 Basically, the uClinux dist includes a few thread demos - thdm and bcdm - running them simultaneously sometimes causes bus errors. Bernd wrote: >They occur in pthread_handle_sigrestart; thread_self returns a bogus value. >I managed to capture a debugging log, it's attached as bad-log. If you >look at it you'll notice that the initial stack bounds are bogus: bottom >of stack is higher than top of stack. This appears to be because of a bug >in NOMMU_INITIAL_THREAD_BOUNDS(tos,bos): if a new thread has a BOS equal >to the initial thread's current TOS, it'll munge the initial thread's >stack bounds. Fixed with the attached patch, which I've committed. >This should fix the crashes people have seen, but since the bug was always >hard to reproduce, I can't be 100% certain they are gone. Please retest, >everyone... This patch was made against our cvs, which has an older version of uClibc in it - this code was recently moved from internals.h to descr.h in the uclibc svn, but it still has the same problem --- libpthread/linuxthreads/descr.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libpthread') diff --git a/libpthread/linuxthreads/descr.h b/libpthread/linuxthreads/descr.h index fd9e8d461..fb5fa350e 100644 --- a/libpthread/linuxthreads/descr.h +++ b/libpthread/linuxthreads/descr.h @@ -214,7 +214,10 @@ struct _pthread_descr_struct extern char *__pthread_initial_thread_bos; #ifndef __ARCH_HAS_MMU__ extern char *__pthread_initial_thread_tos; -#define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) if ((tos)>=__pthread_initial_thread_bos && (bos)<=__pthread_initial_thread_tos) __pthread_initial_thread_bos = (tos)+1 +#define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) \ + if ((tos)>=__pthread_initial_thread_bos \ + && (bos)<__pthread_initial_thread_tos) \ + __pthread_initial_thread_bos = (tos)+1 #else #define NOMMU_INITIAL_THREAD_BOUNDS(tos,bos) /* empty */ #endif /* __ARCH_HAS_MMU__ */ -- cgit v1.2.3