mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Caleb Kan <calebkan1106@gmail.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 kasan-dev@googlegroups.com, Vlastimil Babka <vbabka@kernel.org>,
	 Alexander Potapenko <glider@google.com>,
	Marco Elver <elver@google.com>,
	 Dmitry Vyukov <dvyukov@google.com>,
	Andrey Konovalov <andreyknvl@gmail.com>,
	 Oscar Salvador <osalvador@suse.de>,
	Caleb Kan <ckan@cloudflare.com>,
	 kernel-team@cloudflare.com
Subject: [PATCH RFC 8/9] scripts/gdb: reject trie-backed stack depot handles
Date: Mon, 17 Aug 2026 13:42:48 +0100	[thread overview]
Message-ID: <20260817-stackdepot-trie-v1-8-53870ca1651b@cloudflare.com> (raw)
In-Reply-To: <20260817-stackdepot-trie-v1-0-53870ca1651b@cloudflare.com>

From: Caleb Kan <ckan@cloudflare.com>

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 <ckan@cloudflare.com>
---
 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)


  parent reply	other threads:[~2026-08-17 12:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-17 12:42 [PATCH RFC 0/9] Path-compressed trie storage for persistent stack depot records Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 1/9] stackdepot: share persistent stack prefixes with trie storage Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 2/9] stackdepot: add KUnit tests for " Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 3/9] mm/page_owner: preserve accounting with countable stack depot records Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 4/9] mm/kmemleak: print trie-backed stack depot traces Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 5/9] kmsan: report " Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 6/9] mm/slub: materialize " Caleb Kan
2026-08-17 12:42 ` [PATCH RFC 7/9] drm/locking: preserve deadlock diagnostics for trie-backed stacks Caleb Kan
2026-08-17 12:42 ` Caleb Kan [this message]
2026-08-17 12:42 ` [PATCH RFC 9/9] stackdepot: add boot-time activation for trie storage Caleb Kan
2026-08-18 13:17 ` [PATCH RFC 0/9] Path-compressed trie storage for persistent stack depot records Marco Elver
2026-08-18 16:28   ` Caleb Kan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260817-stackdepot-trie-v1-8-53870ca1651b@cloudflare.com \
    --to=calebkan1106@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=ckan@cloudflare.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kernel-team@cloudflare.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=osalvador@suse.de \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®