From: "Masami Hiramatsu (Google)" <mhiramat@kernel.org>
To: Masami Hiramatsu <mhiramat@kernel.org>,
Steven Rostedt <rostedt@goodmis.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org
Subject: [PATCH 4/4] tools/bootconfig: Add tests for unclosed brace position and mixed-kv limits
Date: Sun, 22 Nov 2026 10:01:59 +0900 [thread overview]
Message-ID: <179530931973.109991.15787416583892751589.stgit@devnote2> (raw)
In-Reply-To: <179530928294.109991.3079999508446852151.stgit@devnote2>
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Add regression test cases to test-bootconfig.sh for:
1. Unclosed brace error position reporting in xbc_verify_tree()
(verifying both samples/bad-tree.bconf and a multi-block config).
2. XBC_DEPTH_MAX (16) and XBC_KEYLEN_MAX (256) enforcement on subkeys
under a key node that also has a value (mixed value+subkey).
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
---
tools/bootconfig/test-bootconfig.sh | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
diff --git a/tools/bootconfig/test-bootconfig.sh b/tools/bootconfig/test-bootconfig.sh
index f584f7637e12..6b396dea9095 100755
--- a/tools/bootconfig/test-bootconfig.sh
+++ b/tools/bootconfig/test-bootconfig.sh
@@ -220,6 +220,39 @@ xpass $BOOTCONF -a $TEMPCONF $INITRD
$BOOTCONF $INITRD > $OUTFILE
xpass grep -q "value" $OUTFILE
+echo "Unclosed brace error position"
+cat > $TEMPCONF << EOF
+a {
+ b = 1
+}
+c {
+ d = 2
+EOF
+echo > $INITRD
+
+xfail $BOOTCONF -a $TEMPCONF $INITRD
+$BOOTCONF -a $TEMPCONF $INITRD > $OUTFILE 2>&1
+xpass grep -q "Brace.is.not.closed.at.4:1" $OUTFILE
+$BOOTCONF -a samples/bad-tree.bconf $INITRD > $OUTFILE 2>&1
+xpass grep -q "Brace.is.not.closed.at.2:1" $OUTFILE
+
+echo "Mixed value and subkey depth/length limits"
+cat > $TEMPCONF << EOF
+k1 = v1
+k1.k2.k3.k4.k5.k6.k7.k8.k9.k10.k11.k12.k13.k14.k15.k16.k17 = v2
+EOF
+xfail $BOOTCONF -a $TEMPCONF $INITRD
+
+awk '
+BEGIN {
+ printf("root = v\nroot.")
+ for (i = 0; i < 255; i += 1)
+ printf("a")
+ printf(" = v2\n")
+}
+' > $TEMPCONF
+xfail $BOOTCONF -a $TEMPCONF $INITRD
+
echo "=== expected failure cases ==="
for i in samples/bad-* ; do
xfail $BOOTCONF -a $i $INITRD
prev parent reply other threads:[~2026-11-22 1:02 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 1:01 [PATCH 0/4] bootconfig: Fix tree verification, key composition, and cmdline rendering bugs Masami Hiramatsu (Google)
2026-11-22 1:01 ` [PATCH 1/4] bootconfig: Fix xbc_verify_tree() to check subkeys of valued keys Masami Hiramatsu (Google)
2026-11-22 1:01 ` [PATCH 2/4] bootconfig: Fix xbc_node_compose_key_after() for value nodes Masami Hiramatsu (Google)
2026-11-22 1:01 ` [PATCH 3/4] bootconfig: Avoid out-of-bounds pointer arithmetic in xbc_snprint_cmdline_filter() Masami Hiramatsu (Google)
2026-11-22 1:01 ` Masami Hiramatsu (Google) [this message]
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=179530931973.109991.15787416583892751589.stgit@devnote2 \
--to=mhiramat@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=rostedt@goodmis.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®