mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] scripts/gdb: Fix stack depot out-of-bounds diagnostic
@ 2026-10-07 10:35 Ting-Han Hou
  2026-10-09 18:10 ` Ting-Han Hou
  0 siblings, 1 reply; 2+ messages in thread
From: Ting-Han Hou @ 2026-10-07 10:35 UTC (permalink / raw)
  To: Jan Kiszka, Kieran Bingham; +Cc: linux-kernel, Kuan-Ying Lee

From: Ting-Han Hou <ue081723@gmail.com>

The pool_index field was renamed to pool_index_plus_1, but the
out-of-bounds diagnostic in stack_depot_fetch() still accesses the old
field. Looking up a handle whose pool index is outside stack_pools
therefore raises "There is no member named pool_index" instead of
printing the diagnostic and returning an empty result.

Use the already decoded pool_index variable in the diagnostic.

Fixes: 9d938f40b228 ("scripts/gdb: rename pool_index to pool_index_plus_1")
Assisted-by: LLM
Signed-off-by: Ting-Han Hou <ue081723@gmail.com>
---
Tested the complete lx-stack_depot_lookup command with GDB 15.1 and
a GCC-built ELF fixture using the handle bitfield layout for 4 KiB
pages. The fixture contains one pool and a valid stack entry.

Handles 2 and 0xffff fail with the missing-member exception before the
fix and print the correct out-of-bounds diagnostic after it. Handle 1
still prints the expected instruction, and handle 0 retains its
existing rejection.

 scripts/gdb/linux/stackdepot.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/gdb/linux/stackdepot.py b/scripts/gdb/linux/stackdepot.py
--- a/scripts/gdb/linux/stackdepot.py
+++ b/scripts/gdb/linux/stackdepot.py
@@ -39,7 +39,7 @@

     pool_index = parts['pool_index_plus_1'] - 1
     if pool_index >= pools_num:
-        gdb.write("pool index %d out of bounds (%d) for stack id
0x%08x\n" % (parts['pool_index'], pools_num, handle))
+        gdb.write("pool index %d out of bounds (%d) for stack id
0x%08x\n" % (pool_index, pools_num, handle))
         return gdb.Value(0), 0

     stack_pools = gdb.parse_and_eval('stack_pools')

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-09 18:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-07 10:35 [PATCH] scripts/gdb: Fix stack depot out-of-bounds diagnostic Ting-Han Hou
2026-10-09 18:10 ` Ting-Han Hou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®