-
-
Notifications
You must be signed in to change notification settings - Fork 609
Description
Commit 6ddf46b fixed a stack overflow on the interrupt stack in debug mode by increasing the size of that stack in debug build mode. The debug build mode is detected by the absence of the NDEBUG macro (which is defined in release mode):
Line 1 in bd0a0e1
| conf-opt = -O2 -DNDEBUG |
This is hacky but at least for the arch-switch.hh header it works as this header is only included from core/, which is compiled with the mode-specific CFLAGS. However, for the arch-cpu.hh header this approach doesn't work at all because this header is included from osv/sched.hh which part of the public API:
Line 13 in 2a8035a
| #include "arch-cpu.hh" |
Therefore, every software which includes osv/sched.hh must also compile with the mode-specific CFLAGS (e.g., include NDEBUG in release mode), which isn't necessarily the case. As such, code in core/* and application code will disagree on sizeof(arch_thread) and this causes very hard to debug bugs since arch_thread is part of sched::thread:
Line 832 in 2a8035a
| arch_thread _arch; |
As a result, code in core/* and application code will disagree on struct member offsets beyond _arch, causing hard to debug memory corruptions.
Noticed this due to broken stat counters while rebasing #1338.