This is an automated email from the ASF dual-hosted git repository.

acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/master by this push:
     new 059176fe641 sched: avoid dumping raw memory at address 0 for tasks 
without kstack
059176fe641 is described below

commit 059176fe641510325e92ffa1ae8a97c8cc0be6e4
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,

Reply via email to