From: Caleb Kan The lx-stack_depot_lookup command can reconstruct stacks only from contiguous hash-backed records. A later patch will encode trie-backed handles as dense stack IDs in pool_index_plus_1 and offset. Without an explicit check, a trie handle enters the hash-only out-of-bounds path. Reject pool_index_plus_1 values above stack_max_pools before looking up a hash pool, and report that trie-backed handles are unsupported. Supporting them would require the helper to walk the side table and parent links, 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)