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 23EA63064B5 for ; Fri, 13 Mar 2026 08:51:03 +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=1773391864; cv=none; b=gwsPHWuOOuEqA/OYl4mmqyDshSo0uVdvVxSoqJKBbOOzMO2pNPeKiJwth21qm6N4F3ZZWJXp5yErsnV1lzDaumGlorUbHxFqRQdIBmxZOwcTwnGotei6aKzBzF5HZRuUDYRu7YhLvZx8MtrNr5TGuPKbuOtqzXEeFX/N08nk7zk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773391864; c=relaxed/simple; bh=1KUT9Tf25ZS6VrZia7+QDLQFs4SKqyhZvqzfc04vw8k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=KEXNA0NhmRynIaxBNUfEcHXyhvt7jlJPmJOWQrA1eR5WvU+fGZz8g+Qiftjl/ALaGuRE2yurMtYu/8zkDJHxENkOmT6DV++VOtC/S3aVrX0s47zi0J7ZZmTXQTsZ4+5KxKSKh+kL06zQZK0Ag3NGzxXwGvGI1N9jLMGvc6O4/lw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fMXnoAOQ; 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="fMXnoAOQ" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73E97C19421; Fri, 13 Mar 2026 08:51:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1773391863; bh=1KUT9Tf25ZS6VrZia7+QDLQFs4SKqyhZvqzfc04vw8k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=fMXnoAOQU0/G+r8DPkq+oydoGE9H6DUf2wvwyh8xC86fVKVeEY1g+IxpVxEv8j4oL Pyaz4iO+lYWCVz7h2biCk/IsklGMvlM6pN/y4sChyv5iDLimiyDysTb61GeN6DEeFS j+J/NpSNz4VfxUAVWqep5mkYXV20jsikdgIjsCuLjCnEqG0GEVqz74Z4ZhFRL0bSX5 luExGUclhVGwdQrap00cRrbE+JD9QH9QQcylpQDIsiG7/7SJfdRTk8J9q8cs9DaP8l eKeyMbspFRUlBy+3KMqU5qFIq4AdAzXd0dprSkae8RoYDJyix3r2Z9CB26YOHnGzY3 DTpw12xM5T4WA== From: Pratyush Yadav To: Breno Leitao Cc: Alexander Graf , Mike Rapoport , 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 1/6] kho: add size parameter to kho_add_subtree() In-Reply-To: <20260309-kho-v8-1-c3abcf4ac750@debian.org> (Breno Leitao's message of "Mon, 09 Mar 2026 06:41:44 -0700") References: <20260309-kho-v8-0-c3abcf4ac750@debian.org> <20260309-kho-v8-1-c3abcf4ac750@debian.org> Date: Fri, 13 Mar 2026 08:50:59 +0000 Message-ID: <2vxzms0cgljg.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain On Mon, Mar 09 2026, Breno Leitao wrote: > kho_add_subtree() assumes the fdt argument is always an FDT and calls > fdt_totalsize() on it in the debugfs code path. This assumption will > break if a caller passes arbitrary data instead of an FDT. > > When CONFIG_KEXEC_HANDOVER_DEBUGFS is enabled, kho_debugfs_fdt_add() > calls __kho_debugfs_fdt_add(), which executes: > > f->wrapper.size = fdt_totalsize(fdt); > > Fix this by adding an explicit size parameter to kho_add_subtree() so > callers specify the blob size. This allows subtrees to contain > arbitrary data formats, not just FDTs. Update all callers: > > - memblock.c: use fdt_totalsize(fdt) > - luo_core.c: use fdt_totalsize(fdt_out) > - test_kho.c: use fdt_totalsize() > - kexec_handover.c (root fdt): use fdt_totalsize(kho_out.fdt) > > Also update __kho_debugfs_fdt_add() to receive the size explicitly > instead of computing it internally via fdt_totalsize(). In > kho_in_debugfs_init(), pass fdt_totalsize() for the root FDT and > sub-blobs since all current users are FDTs. A subsequent patch will > persist the size in the KHO FDT so the incoming side can handle > non-FDT blobs correctly. > > Suggested-by: Pratyush Yadav > Reviewed-by: Mike Rapoport (Microsoft) > Signed-off-by: Breno Leitao Reviewed-by: Pratyush Yadav [...] -- Regards, Pratyush Yadav