From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC8D41E0DD8 for ; Sat, 10 Oct 2026 21:17:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791667034; cv=none; b=rzdceAYKc+J4LFzNwAKoi6rsIZBIg5L7kA1Tu1gIDIDq1ECwOtnDrN1s9dqyllkF8ocxHA7sGStDpgfOtVI9H+uGooKVMPAOFr8MQJyqm5MSS83BWTfls4IVX40mGDLnqb35lobdiXfNdneX6xBIX0gI5KP86LylQrDH5HDL7ZE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791667034; c=relaxed/simple; bh=6iiabgbJSSyG/pyja3OmwqGFhZ60hun1d+bHgTGnL/4=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=YNVuYJyQMN/uzshnJYOmAYCOOqCoTNPuue4wDDEic8EzoClXUKctRnRU+R/AmyCWxPxuTxvGiJRMvpI65lkVYvjzMVu4AOqDLotPYzqiQilPbO5S5Ybwsu/azUcFVmwzgZbYVI+dnRjFM+9nhILerFFt0LI6i6N4FL0wYP3tB8k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=l45LIZ/3; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="l45LIZ/3" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 278961F000FF; Sat, 10 Oct 2026 21:17:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1791667033; bh=SGbUFSuaUrBJY/CKBm2b4LnsbB2Ht0VGwA82HHvjOeU=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=l45LIZ/3j8ZhFv+AfVXuLc4eWvvAyogiUppvD/1GkCswuToHbKfpl5Cp8wwATYoFo is9qc1mvPC/cqy+YweKzZn19o3IRsdR1AmKT5lrunTy4YOwyvHTSpFA/IswlLuDXMk i1VAdodt71uBR3Pse6qBamJeUvKZEZIzceUmW+Zg= Date: Sat, 10 Oct 2026 14:17:12 -0700 From: Andrew Morton To: Ting-Han Hou Cc: Jan Kiszka , Kieran Bingham , linux-kernel@vger.kernel.org Subject: Re: [PATCH] scripts/gdb: Fix radix tree lookup pointer handling Message-Id: <20261010141712.2db4491436e30110ccb5a25e@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 7 Oct 2026 02:31:24 -0700 Ting-Han Hou wrote: > lookup() casts each slot to a pointer to a node pointer and then > dereferences it. Since the slot already contains an entry pointer, > this reads the entry's contents as another pointer instead of > returning the entry itself. > > Internal entries also need their tag bits removed before descending > to the next node. > > Return non-internal entries directly and use entry_to_node() when > descending through internal entries. Remove the explicit shift > counter, as traversal now follows the entry type. > > Fixes: b7235d6bb516 ("scripts/gdb: add a Radix Tree Parser") > Assisted-by: LLM > Signed-off-by: Ting-Han Hou > --- > Tested with GDB 15.1 against standalone GCC-built C fixtures using the > xarray/xa_node field layout, with XA_CHUNK_SHIFT=4 and 6. These are > synthetic debugger fixtures, not a booted kernel or a kernel core dump. > > Before the fix, a one-level lookup returned the payload 0x12345678 > instead of its address; a two-level lookup missed a populated slot. > After the fix, all 33 checks passed for each slot configuration (66 > total), including empty/direct roots, one- to three-level trees, > zero-filled payloads, value entries, absent/out-of-range indices, > struct/pointer roots, and the GDB convenience function. > > This does not test multi-index entries or concurrent updates/retry > entries. The change is limited to the debugger lookup helper. Thanks. Sashiko expressed a concern: https://sashiko.dev/#/patchset/CA+NtrhTyE4J-C2=hSUXYc+NJBsQeYvbwJb+-ROHE1QQP-_gYzg@mail.gmail.com your other patch doesn't apply due to word-wrapping. Please turn these into a 2-patch series.