开发者

DIY stack protection

开发者 https://www.devze.com 2023-02-23 00:59 出处:网络
I have a Android NDK project in C++. Customers are complaining of intermittent, irreproducible glitches. I suspect a memory corruption bug somewhere. I already have a malloc barrier; now I want to che

I have a Android NDK project in C++. Customers are complaining of intermittent, irreproducible glitches. I suspect a memory corruption bug somewhere. I already have a malloc barrier; now I want to check for stack corruption.

GCC's -fstack-protector sounds too extreme to me; when it detects a bug, it just kills the program; I want something more user-friendly (a message, THEN kill :)). Question - is there a way to implement, under GCC, a stack consistency checker under programmer's control? I don't mind inline assembly.

Some predefined macros that expose the stack frame structure, for example, woul开发者_开发百科d come in handy.


See the top-most answer to this question, on why stack-protecter is for hardening, and not debugging: When and how to use GCC's stack protection feature?

0

精彩评论

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