[DGD] sig11, snapshot restore and stack size

bart at wotf.org bart at wotf.org
Wed Mar 16 19:05:31 CET 2016


I have a rather huge object in a snapshot file, and dgd was ending in a sig11
on actually trying to use said object after a restore.

Looking at what was happening made me end up in d_conv() where a buffer (buf)
is allocated with ALLOCA.

It tried to allocate approx 14mb, while the maximum stack size was 8mb.
According to man alloca the resulting behavior is undefined.

After changing the stack size to 32mb, the object could be restored properly.

However, this prevents the issue in this specific case, but the potential of
overflowing the stack due to such an object is still there, and its not
obvious until after you try an actual restore. You'll have to look with a
debugger at how large your stack should be to avoid a particular case.

I probably shouldn't be creating such a large object, but I also don't think
just assuming it will fit the stack is such a good idea, actually, I'm not
sure this buffer should be on the stack at all considering the rather
unpredictable size it can have.

Any thoughts?

Bart.
--
http://www.flickr.com/photos/mrobjective/
http://www.om-d.org/




More information about the DGD mailing list