This is an automated email from the ASF dual-hosted git repository. xiaoxiang781216 pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 8bad9c478f1e25631c501082c88b2269f6564d0e Author: dengwenqi <[email protected]> AuthorDate: Tue May 5 10:21:47 2026 +0800 sched/assert: silence ASAN for stack_dump() Under the SIM + AddressSanitizer build, the task stack is allocated via posix_memalign() from the host heap. ASAN inserts per-frame redzones inside that allocation, so bytes that are legitimately within the [base, base+size) stack region but outside the currently active frames are marked as poisoned. stack_dump() intentionally walks the whole stack region to print its contents for crash diagnosis. The DUMP_PTR() macro bounds-checks against stack_top but has no way to know about ASAN's intra-allocation redzones, so a 4-byte read at a poisoned slot is reported as: AddressSanitizer: stack-buffer-overflow SUMMARY: misc/assert.c:166 in stack_dump This faulted during dump_assert_info() for a separate nxsem_wait_irq assertion, masking the real assertion with a secondary ASAN crash and preventing the full stack trace from being printed. Root cause: stack_dump() reads bytes the allocator considers valid but ASAN has poisoned (redzones between stack frames). Fix: annotate stack_dump() with nosanitize_address so ASAN skips memory access instrumentation inside this diagnostic helper. Same pattern as the existing arch backtrace helpers (arch/sim/src/sim/sim_backtrace.c, arch/risc-v/src/common/riscv_backtrace.c, etc.). Signed-off-by: dengwenqi <[email protected]> --- sched/misc/assert.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sched/misc/assert.c b/sched/misc/assert.c index b1e9a7cd994..89378c7d241 100644 --- a/sched/misc/assert.c +++ b/sched/misc/assert.c @@ -192,6 +192,7 @@ static void sp_out_of_range(uintptr_t sp) * Name: stack_dump ****************************************************************************/ +nosanitize_address static void stack_dump(uintptr_t sp, uintptr_t stack_top) { uintptr_t stack;
