Segmentation fault in ld.lib.so when using gzread
Johannes Schlatow
schlatow at ...238...
Fri Oct 31 10:36:24 CET 2014
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.
Cheers
Johannes
On Fri, 31 Oct 2014 08:30:06 +0100
Christian Helmuth <christian.helmuth at ...1...> wrote:
> Hey,
>
> 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.
>
> Greets
> Christian
>
> On October 30, 2014 8:01:05 PM CET, Johannes Schlatow
> <schlatow at ...238...> wrote:
> >Hey everyone,
> >
> >I'm using some 3rd party code that depends on zlib. In particular, it
> >uses gzread() in order to read a file. Unfortunately, the
> >corresponding piece of code causes a segfault in ld.lib.so.
> >
> >I narrowed this down to the following minimum example:
> >
> > gzFile gzfile_components = gzopen("test.txt", "rb");
> > unsigned char buffer[1024*1024];
> > gzread(gzfile_components, buffer, sizeof(buffer));
> >
> >As you can see, the buffer is quite large but this the actual (and
> >reasonable) value used in the 3rd party code.
> >As soon as I reduce the size to e.g. 4096, the segfault is gone.
> >
> >The file I used has a size of 293 bytes. I'm using base-linux.
> >I also remember using this code successfully on a different computer
> >with an older version of Genode (14.03).
> >
> >Any ideas/comments on this?
> >
> >------------------------------------------------------------------------------
> >_______________________________________________
> >genode-main mailing list
> >genode-main at lists.sourceforge.net
> >https://lists.sourceforge.net/lists/listinfo/genode-main
>
--
Johannes Schlatow, M.Sc.
IDA, Institute of Computer and Network Engineering
Technische Universität Braunschweig
Hans-Sommer-Str. 66
38106 Braunschweig - Germany
Phone +49 531 391 - 9668
www.ida.ing.tu-bs.de
schlatow at ...238...
More information about the users
mailing list