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):
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:
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:
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.
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
NDEBUGmacro (which is defined in release mode):osv/conf/release.mk
Line 1 in bd0a0e1
This is hacky but at least for the
arch-switch.hhheader it works as this header is only included fromcore/, which is compiled with the mode-specific CFLAGS. However, for thearch-cpu.hhheader this approach doesn't work at all because this header is included fromosv/sched.hhwhich part of the public API:osv/include/osv/sched.hh
Line 13 in 2a8035a
Therefore, every software which includes
osv/sched.hhmust also compile with the mode-specific CFLAGS (e.g., includeNDEBUGin release mode), which isn't necessarily the case. As such, code incore/*and application code will disagree onsizeof(arch_thread)and this causes very hard to debug bugs sincearch_threadis part ofsched::thread:osv/include/osv/sched.hh
Line 832 in 2a8035a
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.