Is there a programmatic way to check stack corruption

后端 未结 8 1185
北海茫月
北海茫月 2021-02-08 21:29

I am working with a multithreaded embedded application. Each thread is allocated stack sizes based on its functionality. Recently we found that one of the thread corrupted the s

8条回答
  •  天命终不由人
    2021-02-08 21:50

    As Lee mentions, your best bet might be to port Electric Fence to your ARM9 proprietary compiler. Failing that, the ARM ABI and stack format is well documented, so you could write a CHECK_STACK function that verifies that the return addresses point to functions, etc.

    However, it's hard to truly write some of these checks though unless you're the compiler, so if you're not particularly tied to this compiler, GCC does support ARM and it also supports stack guards.

提交回复
热议问题