|
From: Jeremy F. <je...@go...> - 2004-06-01 05:47:00
|
On Sat, 2004-05-29 at 12:13 +0100, Tom Hughes wrote: > Has anybody actually had valgrind running on FC2 yet? > > I don't seem to be able to get it to do anything more that SEGV on > startup at the moment, and I can't even attach gdb to it as it just > seems to hang... I built my own gdb 6 from source, and it seems to work - the FC2 standard one hangs for me too. I got some insight into what's happening. The initial problem is caused by VDSOs, which are placed low in the address space. When Valgrind clears out the client area in stage2, it also clears out the sysinfo page, which happens to be where the munmap syscall returns to... So, if you turn off VDSOs (echo 0 > /proc/sys/kernel/vdso), you get to the next crash. This is a fair bit further on, typicially when the client wants to expand the stack. It gets a fault, calls our SIGSEGV handler, which expands the stack, and then returns from the handler with the intent of restarting the faulting instruction - BANG. The handler returns to address 0x440 and explodes. I haven't confirmed this yet, but it looks to me like a FC2 kernel bug. I'm guessing that when it sets up the signal frame return address, it uses the sysinfo syscall return address, which is sysinfo_page + 0x440 - and since the sysinfo page hasn't been installed, it's just 0x440. Either way, this is pretty tricky to deal with. We basically have to leave the sysinfo page alone, even though it's sitting in the middle of the client address space. We can't unmap it, because the signal delivery machinery will still keep trying to use it. J |