A GCC -fstack-protector vulnerability on arm64
A GCC -fstack-protector vulnerability on arm64
Posted Sep 17, 2023 10:31 UTC (Sun) by excors (subscriber, #95769)In reply to: A GCC -fstack-protector vulnerability on arm64 by ianmcc
Parent article: A GCC -fstack-protector vulnerability on arm64
If you're developing for a single-application embedded environment, then I think it often *is* a good idea to calculate your worst-case heap usage and statically allocate that, so you can be sure the application will meet its specification and won't crash from resource exhaustion when given a valid input. Limited dynamicity can be done with statically-sized pool allocators, where higher-level code allocates a whole complex data structure and allocation failure can either be prevented (e.g. by verifying the resource requirements of a request before accepting it, or applying backpressure to a message queue before you get overloaded, etc) or handled gracefully (unwinding the operation and returning a meaningful error to the user), in contrast to a global heap which might fail in any of your many thousands of low-level std::vector/etc operations where it's practically impossible to recover except by crashing and restarting the whole application.