This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/13.0 by this push:
new 7667d6a9fa2 sched: avoid dumping raw memory at address 0 for tasks
without kstack
7667d6a9fa2 is described below
commit 7667d6a9fa2e2d6db5662f969af9919dc06be513
Author: liang.huang <[email protected]>
AuthorDate: Sat Jul 18 11:38:39 2026 +0800
sched: avoid dumping raw memory at address 0 for tasks without kstack
dump_stacks() only checked kernelstack_sp != 0 || force, so for tasks
with no kernel stack (e.g. idle, kernelstack_base == 0) the force path
passed base 0 to dump_stackinfo() and dumped raw memory from address 0,
triggering a secondary fault that truncated the panic log. Guard with
kernelstack_base != 0.
Signed-off-by: liang.huang <[email protected]>
---
sched/misc/assert.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/sched/misc/assert.c b/sched/misc/assert.c
index 57db0448f1f..0f59d3ce757 100644
--- a/sched/misc/assert.c
+++ b/sched/misc/assert.c
@@ -325,7 +325,11 @@ static void dump_stacks(FAR struct tcb_s *rtcb, uintptr_t
sp)
#endif
#ifdef CONFIG_ARCH_KERNEL_STACK
- if (kernelstack_sp != 0 || force)
+ /* kernelstack_base is NULL for tasks with no kernel stack (e.g. idle).
+ * dump_stackinfo() would then dump raw memory starting at address 0.
+ */
+
+ if (kernelstack_base != 0 && (kernelstack_sp != 0 || force))
{
dump_stackinfo("Kernel",
kernelstack_sp,