This is the mail archive of the libc-ports@sources.redhat.com mailing list for the libc-ports project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

User defined stacks for threads


Hi,

I am currently working with threads using linux 2.6.11 and glibc 2.3.5 on
x86. When i am trying to create thread with user defined stacks glibc gives
segmentation fault. I have written a wrapper to pthread_create () and
generated shared object for the same. When i am trying to create any thread
(for user defined stack) using this shared object i am getting segmentation
fault. If i don't create shared object and try to create thread (with user
defined stack) using same code, it works fine. I am not able to understand
this behavior. Why creating a thread using shared object shall result in
segfault. And how to overcome this situation.

NOTE: I got same behavior when tried with linux 2.6.12 and glibc-2.3.6 on
arm platform.


gdb output for the behavior is :

Loaded symbols for /lib/libgcc_s.so.1
#0  0x0018a777 in memset () from /lib/libc.so.6
(gdb) bt'
#0  0x0018a777 in memset () from /lib/libc.so.6
No symbol table info available.
#1  0x003e27ef in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
No symbol table info available.
#2  0x003e29fd in pthread_create@GLIBC_2.0 () from /lib/libpthread.so.0
No symbol table info available.
#3  0x00ed9880 in process_create (entry_point=0x8048f4c <ThreadEntryPoint>,
pArg=0x1, pStack=0x82e08a8, ulStack_Size=16384, ulPrio=127)
    at multithreading.c:1916
    stThAttr = {__size =
"c\000\000\000\002\000\000\000j\000\000\000\000\020\000\000ÂH.\b\000@", '\0'
<repeats 13 times>, __align = 99}
    stSchedParam = {__sched_priority = 99}
    pstTd = (ThreadData_t *) 0xedd7d8
    state = 0
    chPriority = 99 'c'
    ulRetVal = 0
    pRetVal = 0x0
    __FUNCTION__ = "process_create"
#4  0x08049af8 in process_create_test (ulInParam=1) at
multithreading_test.c:539
    ulIndex = 0
    lRetVal = -1
    ulThreadIndex = 1
    lTestPassFlag = 0
    stack = (void *) 0x82d88a8
    pStack = (void *) 0x82e08a8
    ulPrio = 127
    stackSize = 16384
    __FUNCTION__ = "process_create_test"
#5  0x0804b14b in main () at multithreading_test.c:1460
    chChoice = "1"
    lChoice = 1
    stack = (void *) 0x0
    stackSize = 0
    ulPrio = 0
    ulLoopIndex = 0
    stTime = 134533384
    stTimeInfo = {tm_sec = 4, tm_min = 53, tm_hour = 7, tm_mday = 7, tm_mon
= 3, tm_year = 74, tm_wday = 0, tm_yday = 96, tm_isdst = 0,
  tm_gmtoff = 19800, tm_zone = 0x82d81b8 "IST"}
    achTimebuf = "04/07/1974 07:53:w"
    stThAttr = {__size = '\0' <repeats 13 times>, "\020", '\0' <repeats 21
times>, __align = 0}
    lFlag = 1
    chFlag = 0
    lTestPassFlag = 0
    ulThreadIndex = 0
    ulloopIndex = 1
    ulThreadId = {0, 0, 0, 0}
    __FUNCTION__ = "main"
(gdb) f 0
#0  0x0018a777 in memset () from /lib/libc.so.6
(gdb) f 1
#1  0x003e27ef in pthread_create@@GLIBC_2.1 () from /lib/libpthread.so.0
(gdb)

-- 
View this message in context: http://www.nabble.com/User-defined-stacks-for-threads-tp16392122p16392122.html
Sent from the Sourceware - libc-ports mailing list archive at Nabble.com.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]