开发者

Reason for difference stack smashing behaviour between machines

We're trying to track down some stack smashing errors in some gen开发者_如何学Cerated code. The problem is that the stack smashing errors are not 100% deterministic and only happens on one machine and not others. What possible reasons could there be for the difference in behaviour?

We're running gcc using the stack protector flags.


Try using Valgrind

Memcheck: a memory error detector

If threads and timing are involved it is possible that it could happen on rare or unpredictable occasions. I've seen multi-threaded code work 99 times out of 100....and then fail. If you are lucky it's just a stack overwrite error that happens all the time but only occasionally has consequences.

Ptrcheck: an experimental heap, stack and global array overrun detector

-fstack-protector + valgrind ==> stack array overflow debugging?

You could try enabling stack canaries with gcc's -fstack-protector-all option.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜