From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4F455371043 for ; Tue, 10 Mar 2026 10:36:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773139007; cv=none; b=ZtgwzBusy74uhM9Eic3Jm0USgSnUnTGj5J6SgG9rRoTTlWm6p9zmNgh3XmIf4gW6saxEhlx0QodWjVW9pqpOdBpCAlVxAzLA6ZdZkxfcOwaLiqWftMwq0avvu4DTCrYJqmegebTbc/B6nJuelE0E+R7odkdO7hWfNFxCS95nqIg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773139007; c=relaxed/simple; bh=W9mAwkbLlYnKfeePBjebcYRdBnJ6E2MpSEq54ioYRzw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=LbCFmC1vMEndMT9XmDgTYpZVVPmCrWgxeyJyY+U0ll2HOQPmT+IvWcAFBrLjevbEqyZoL4vpbIp3n8w+uLQs+C10EM/ovr/xMOAqjHWyfJsaAtTCrC6jVBr20mfumvv12CF7a3LveD14o4uE8zeM6mf0PXzViFBXgz99MwdB6HA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=c4P/dioT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="c4P/dioT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9FB4C19423; Tue, 10 Mar 2026 10:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773139007; bh=W9mAwkbLlYnKfeePBjebcYRdBnJ6E2MpSEq54ioYRzw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=c4P/dioTx1zil8ozOzqhL6X/9iGKpOVhuU526quBqtwWSPwFQSEZoIJMVmJJUsOF5 nwKORBgb0pGbSD59iNFGvajMzeEB+l90b66z07ro+54oDBh7pDJRwjyM2jjW4fM4pO xcrbr14WA961xY1LpW+mTGorEMhcXxAR0O15Tg8HHIiCiRG8dLKVGWu/HHvBcZENzO hXNLQnxrOmRnWvmMOMFR0ufoj3F6tuAXdD9kMzpfuGtqhlfmHXyrwOwBlv9FFYu/7d +22JF3UWxgN3RP3N9VaBWLPofEMoo6/DvR+oB87o/Sqvkiy5/LNe5KvzyURJyMqiFq a8o+ZkcX6YwPg== Date: Tue, 10 Mar 2026 12:36:40 +0200 From: Mike Rapoport To: Breno Leitao Cc: Alexander Graf , Pasha Tatashin , Pratyush Yadav , linux-kernel@vger.kernel.org, kexec@lists.infradead.org, linux-mm@kvack.org, usamaarif642@gmail.com, SeongJae Park , kernel-team@meta.com Subject: Re: [PATCH v8 4/6] kho: fix kho_in_debugfs_init() to handle non-FDT blobs Message-ID: References: <20260309-kho-v8-0-c3abcf4ac750@debian.org> <20260309-kho-v8-4-c3abcf4ac750@debian.org> 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-Disposition: inline In-Reply-To: <20260309-kho-v8-4-c3abcf4ac750@debian.org> On Mon, Mar 09, 2026 at 06:41:47AM -0700, Breno Leitao wrote: > kho_in_debugfs_init() has two problems when displaying incoming > sub-blobs in debugfs: > > 1. It uses the hardcoded property name "fdt" instead of > KHO_SUB_TREE_PROP_NAME ("preserved-data"), so it never finds > subtrees stored by the current kho_add_subtree(). > > 2. It calls fdt_totalsize() to determine blob sizes, which assumes > all blobs are FDTs. This breaks for non-FDT blobs like struct > kho_kexec_metadata. > > Fix both issues by using KHO_SUB_TREE_PROP_NAME to find subtrees > and reading the "blob-size" property from the FDT (persisted by > kho_add_subtree()) instead of calling fdt_totalsize(). > > Signed-off-by: Breno Leitao Reviewed-by: Mike Rapoport (Microsoft) > --- > kernel/liveupdate/kexec_handover_debugfs.c | 34 ++++++++++++++++++++---------- > 1 file changed, 23 insertions(+), 11 deletions(-) > > diff --git a/kernel/liveupdate/kexec_handover_debugfs.c b/kernel/liveupdate/kexec_handover_debugfs.c > index 7a100f2bf3947..257ee8a52be66 100644 > --- a/kernel/liveupdate/kexec_handover_debugfs.c > +++ b/kernel/liveupdate/kexec_handover_debugfs.c > @@ -13,6 +13,7 @@ > #include > #include > #include > +#include > #include "kexec_handover_internal.h" > > static struct dentry *debugfs_root; > @@ -121,23 +122,34 @@ __init void kho_in_debugfs_init(struct kho_debugfs *dbg, const void *fdt) > fdt_for_each_subnode(child, fdt, 0) { > int len = 0; > const char *name = fdt_get_name(fdt, child, NULL); > - const u64 *fdt_phys; > - void *sub_fdt; > + const u64 *blob_phys; > + const u64 *blob_size; > + void *blob; > > - fdt_phys = fdt_getprop(fdt, child, "fdt", &len); > - if (!fdt_phys) > + blob_phys = fdt_getprop(fdt, child, > + KHO_SUB_TREE_PROP_NAME, &len); > + if (!blob_phys) > continue; > - if (len != sizeof(*fdt_phys)) { > - pr_warn("node %s prop fdt has invalid length: %d\n", > - name, len); > + if (len != sizeof(*blob_phys)) { > + pr_warn("node %s prop %s has invalid length: %d\n", > + name, KHO_SUB_TREE_PROP_NAME, len); > continue; > } > - sub_fdt = phys_to_virt(*fdt_phys); > + > + blob_size = fdt_getprop(fdt, child, > + KHO_SUB_TREE_SIZE_PROP_NAME, &len); > + if (!blob_size || len != sizeof(*blob_size)) { > + pr_warn("node %s missing or invalid %s property\n", > + name, KHO_SUB_TREE_SIZE_PROP_NAME); > + continue; > + } > + > + blob = phys_to_virt(*blob_phys); > err = __kho_debugfs_blob_add(&dbg->fdt_list, sub_fdt_dir, name, > - sub_fdt, fdt_totalsize(sub_fdt)); > + blob, *blob_size); > if (err) { > - pr_warn("failed to add fdt %s to debugfs: %pe\n", name, > - ERR_PTR(err)); > + pr_warn("failed to add blob %s to debugfs: %pe\n", > + name, ERR_PTR(err)); > continue; > } > } > > -- > 2.47.3 > -- Sincerely yours, Mike.