Segmentation fault in ld.lib.so when using gzread

Sebastian Sumpf Sebastian.Sumpf at ...1...
Fri Oct 31 11:46:55 CET 2014


Hi Johannes,

On 10/31/2014 10:36 AM, Johannes Schlatow wrote:
> Christian,
> 
>> You put that quite large buffer on stack. Does the page fault occur
>> in the stack area 0x40000000..0x50000000? Our stacks have a limited
>> size and do not grow automatically.
> 
> That is what I suspect too. After some further testing, I found out
> that the segfault occurs for buffer sizes above 12kB, which I suppose
> is the default stack size in Genode.
> 
> Assuming that I cannot easily move the buffer to the heap, I'll have to
> extend the stack. I suppose the way to go is to create a new
> Genode::Thread for which I can allocate a sufficiently large stack,
> right?
> 
> By the way, you can find the code on github:
> https://github.com/ValiValpas/genode/commit/96ef7acec75c87865b1021d77645a3494b13ac40
> 
> I'm NOT using the staging branch.

Thanks for the link, I have tested it on Linux. As Christian suggested
it is a page fault because of a stack overrun in the main thread. The
main thread has only 64KB of stack. The way I see it you have three
options to allocate the buffer (not counting creating a new thread).

1. Call Genode::env()->heap()->alloc (Assuming you can use the heap)
2. Use an attached dataspace (see:
repos/os/include/os/attached_dataspace.h) in order to request some
memory from your parent.
3. If the above two are not possible in you scenario, I would move the
buffer into the bss segment of your binary by making it a global variable.

Sebastian





More information about the users mailing list