Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
parts of a thread stack mapping, pthread_main_np()
Hi!
I'm trying to get wip/webkit-gtk to run. It dies in its JavaScript
core. I've debugged it so far that I believe that this is caused by
webkit-gtk's garbage collector trying to walk the stack and going over
the boundaries of allocated pages.
I wrote a test program and noticed that pthread_attr_getstack on my
machine usually returns a stacksize of 4MB; however, when I looked at
the mapped pages with pmap(1) I saw that this mapping was split into
multiple parts.
For the main thread, it's 40xxkB plus another variable sized mapping
to get to the total (I think that's the ASLR mapping), for other
threads, it's usually 4032kB + 64kB.
The 64kB match the default guardsize:
stack address: 0x7e610f000000, stack size: 4194304
and from pmap(1):
00007E610EFF0000 64K [ anon ]
00007E610F000000 4032K read/write [ anon ]
so I guess that explains that. However, it looks like my change to
stack(7) was incorrect and the guardsize should be subtracted to get
the top address of the stack mapping, i.e.:
+--------------------+ stack base = stackaddr + stacksize - guardsize
| stack |
| . |
| . | <-- stack pointer
| . | (varies during execution)
| V |
+--------------------+ stackaddr
| guard/redzone |
+--------------------+ stackaddr - guardsize
I also noticed that NetBSD does not provide pthread_main_np() to
identify the main thread of a program; which would be helpful for some
code since the stack layouts are different for main and other threads.
Is there a reason for not providing this, or should we just add it?
Cheers,
Thomas
Home |
Main Index |
Thread Index |
Old Index