From: Caleb Kan The lx-stack_depot_lookup command can materialize stacks only from contiguous hash-backed records. Trie-backed handles instead encode a dense stack ID in pool_index_plus_1 and offset, so treating them as hash handles misreports a valid handle as an out-of-bounds pool index. Reject pool_index_plus_1 values above stack_max_pools before the hash pool lookup and report that trie-backed handles are unsupported. Supporting them would require side-table and parent-link traversal in the helper, which is left for future work. Signed-off-by: Caleb Kan --- scripts/gdb/linux/stackdepot.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/gdb/linux/stackdepot.py b/scripts/gdb/linux/stackdepot.py index 37313a5a51a0..82aeb9f532c3 100644 --- a/scripts/gdb/linux/stackdepot.py +++ b/scripts/gdb/linux/stackdepot.py @@ -37,6 +37,10 @@ def stack_depot_fetch(handle): if handle == 0: raise gdb.GdbError("handle is 0\n") + stack_max_pools = gdb.parse_and_eval('stack_max_pools') + if parts['pool_index_plus_1'] > stack_max_pools: + raise gdb.GdbError("trie-backed stack depot handles are not supported\n") + 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)) -- Git-155)