User defined stack for threads in Linux 2.6.11 + glibc 2.3.5

M

mysterious.ashish

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\02 0\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)


Please let me know if someone can help me.

Thanks,
Ashish
 
F

Flash Gordon

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

<snip>

You need to ask on comp.programming.threads (where the threading experts
hang out) or possibly comp.unix.programmer (where the POSIX experts hang
out as you seem to be using Posix threads). Threads are not part of C
itself but an extension provided by some systems in (sometimes)
incompatible ways.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top