From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388061; b=Vsu/6tHYDBcTowdr7aZP/6Wakvrkp9/hDAF/xZpXuor/TNo8SG85pIWTQinTeCQ+7cjB X3DHtX/Wqm3OM1pjoucHHYhkd0VRSwatBXQLb0Mx16CBY5uXQh1oVnZjIQF3ZqkumEOG8 qecyxkUeyKwkuNqJwRtPJQtSztWx+hQoXNfQZBYWoVupBUWQvf+SkdCRt17HvMi1jtEHB KN3K+GWBDNRLacLcHu0o8lBPsxLOPgqMWJdAnWgQSos/ZVHkNzG4XzPWru/3SlFVErJMO v1Lkgfns9UK56UNZhF0e79owNe78t4Gm9U8x2FXc54PMLgGDtd+sAVB7ZshXfb+CWRg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388061; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=PAJArvld4Qy1jAC3XwDnp3D88M/UkEps3xFbsgO7PPE=; b=S4+OdYkh6pE4br6ZxC1yw+YE4InQ2oOkY7OqaAt8te27Ku3Ocvm41RptjgM7yN62yQ3x XO9IzqswJ4cqKfMQkS6pgdN3UDw0Txb/REH4zGUQn1SmRWTH8vnZu9SCcEBol7r6Vlq2i 8jUmK/I1ubC0A/USq5H+njiE58peUltLwrF9x8A9WXOVW99KCMa6yNA2hrW0860pkMVZ+ KLCgo+3yCq2R1dbgpDpHoJHwAtmkoPm6V3i5ruoHQneDJmr9KOwCHUM48xwNm5JeYaGiZ k2jXPau3h4NkAwHhRT1bE6VYL9OyuMcgzAajsko9pSgOwrBcBBzUsO/kX7cy97rO02Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=AK1AYfyl; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D2089606A322; Fri, 4 Dec 2026 12:41:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=AK1AYfyl Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5F171F00933; Fri, 4 Dec 2026 12:41:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388061; bh=PAJArvld4Qy1jAC3XwDnp3D88M/UkEps3xFbsgO7PPE=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=AK1AYfylc/47cl0dwZKaQietO6zHrSeuzdU4HNQGMGuIUs3XBWflFtg+fkjudaEcR 7Hww9qFh2ScOBn6/PK8ZFGCxpp5tLoa1MfpHRFPnqLZLBxgNI4Kb5QalQvCw8lc0BI 2Yij9lnmXLInjasRX4xQCYe/EOmmlIecVlbBwgf4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhiqi Zhang , "Masami Hiramatsu (Google)" Subject: [PATCH 6.1 0469/1059] bootconfig: Allow keys with the maximum supported depth Date: Fri, 4 Dec 2026 19:00:00 +0900 Message-ID: <20261204100656.406994683@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhiqi Zhang commit cab697164b47eecfa2f146024f5d661f99a1a1e7 upstream. xbc_verify_tree() accepts keys with XBC_DEPTH_MAX (16) components, but xbc_node_compose_key_after() returns -ERANGE immediately after storing the sixteenth component. It rejects the key before discovering that there are no more ancestors to collect. For example, a.b.c.d.e.f.g.h.i.j.k.l.m.n.o.p = value can be attached to an initrd successfully. However, bootconfig -l stops listing and prints "Failed to compose key -34". In the kernel, the same error propagates through copy_xbc_key_value_list() during its length probe, so proc_boot_config_init() returns before creating /proc/bootconfig. Check the array capacity before storing the next component. This lets exactly XBC_DEPTH_MAX components be composed while retaining the check before any out-of-bounds store. I found this issue while reviewing bootconfig's depth handling and used OpenAI Codex to verify the failure and develop the fix. I reviewed the change and wrote and ran the regression tests. Link: https://lore.kernel.org/all/20261104073742.21202-2-zhiqizhangg@gmail.com/ Fixes: 76db5a27a827 ("bootconfig: Add Extra Boot Config support") Cc: stable@vger.kernel.org Signed-off-by: Zhiqi Zhang Signed-off-by: Masami Hiramatsu (Google) Signed-off-by: Greg Kroah-Hartman --- lib/bootconfig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/lib/bootconfig.c +++ b/lib/bootconfig.c @@ -304,9 +304,9 @@ int __init xbc_node_compose_key_after(st node = xbc_node_get_parent(node); while (node && node != root) { - keys[depth++] = xbc_node_index(node); if (depth == XBC_DEPTH_MAX) return -ERANGE; + keys[depth++] = xbc_node_index(node); node = xbc_node_get_parent(node); } if (!node && root)