From: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
To: mhiramat@kernel.org
Cc: rostedt@goodmis.org, linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v2 1/4] tools/bootconfig: Quote event filters in ftrace2bconf.sh
Date: Sat, 31 Oct 2026 11:25:31 +0100 [thread overview]
Message-ID: <8cd8a184cf719c75403507c186331d12500b803a.1793442331.git.edumucelli@gmail.com> (raw)
In-Reply-To: <cover.1793442331.git.edumucelli@gmail.com>
ftrace2bconf.sh emits event filters without enclosing bootconfig quotes.
A filter such as prev_comm == "a,b" is therefore parsed as an array,
while a # truncates the value and a semicolon or closing brace can make
the exported configuration invalid.
Quote filters containing bootconfig delimiters so that the complete
expression remains one value. Choose an enclosing quote that does
not occur in the expression. When both quote types occur alongside a
delimiter, bootconfig cannot represent the filter because it does not
support escape sequences. Warn and skip that filter instead of emitting
invalid bootconfig. Leave filters without delimiters unchanged.
Fixes: 2b86062a34a8 ("tools/bootconfig: Add a script to generates bootconfig from ftrace")
Signed-off-by: Eduardo Mucelli Rezende Oliveira <edumucelli@gmail.com>
---
I tested event filters containing a comma, semicolon, # and closing
brace in a temporary tracefs instance on my Ubuntu machine, running
kernel 7.0.0-38-generic, with recording disabled.
The original export split or truncated these filters, or produced a
config that could not be parsed. With the fix, each expression remained
one value and was restored unchanged. A filter containing an ordinary
space worked in both versions.
I also checked the mixed-quote cases from your review. These now produce
a warning and are skipped, while filters without delimiters still export.
tools/bootconfig/scripts/ftrace2bconf.sh | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
index b01297217cf3..8f3edea79ca0 100755
--- a/tools/bootconfig/scripts/ftrace2bconf.sh
+++ b/tools/bootconfig/scripts/ftrace2bconf.sh
@@ -126,6 +126,19 @@ per_event_options() { # event-dir
fi
val=`cat $evdir/filter`
if [ "$val" != "none" ]; then
+ case "$val" in
+ *[,\;\#\}]*)
+ case "$val" in
+ *\"*\'*|*\'*\"*)
+ cat 1>&2 << EOF
+# WARN: $PREFIX.event.$group.$event.filter cannot be quoted for bootconfig. Skip it.
+EOF
+ return;;
+ *\"*) val="'$val'";;
+ *) val="\"$val\"";;
+ esac
+ ;;
+ esac
emit_kv $PREFIX.event.$group.$event.filter = "$val"
fi
}
--
2.53.0
next prev parent reply other threads:[~2026-10-31 10:25 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-30 12:51 [PATCH 0/4] tools/bootconfig: Preserve tracing settings during export Eduardo Mucelli Rezende Oliveira
2026-10-30 12:51 ` [PATCH 1/4] tools/bootconfig: Quote event filters in ftrace2bconf.sh Eduardo Mucelli Rezende Oliveira
2026-10-31 8:04 ` Masami Hiramatsu (Google)
2026-10-30 12:51 ` [PATCH 2/4] tools/bootconfig: Export replayable event trigger counts Eduardo Mucelli Rezende Oliveira
2026-10-30 12:51 ` [PATCH 3/4] tools/bootconfig: Reset histogram variable tracking for each instance Eduardo Mucelli Rezende Oliveira
2026-10-30 12:51 ` [PATCH 4/4] tools/bootconfig: Preserve paused histograms in ftrace2bconf.sh Eduardo Mucelli Rezende Oliveira
2026-10-31 10:25 ` [PATCH v2 0/4] tools/bootconfig: Preserve tracing settings during export Eduardo Mucelli Rezende Oliveira
2026-10-31 10:25 ` Eduardo Mucelli Rezende Oliveira [this message]
2026-10-31 10:25 ` [PATCH v2 2/4] tools/bootconfig: Export replayable event trigger counts Eduardo Mucelli Rezende Oliveira
2026-10-31 10:25 ` [PATCH v2 3/4] tools/bootconfig: Reset histogram variable tracking for each instance Eduardo Mucelli Rezende Oliveira
2026-10-31 10:25 ` [PATCH v2 4/4] tools/bootconfig: Preserve paused histograms in ftrace2bconf.sh Eduardo Mucelli Rezende Oliveira
2026-10-31 13:07 ` [PATCH v2 0/4] tools/bootconfig: Preserve tracing settings during export Masami Hiramatsu (Google)
2026-10-31 13:31 ` Masami Hiramatsu (Google)
2026-10-31 13:47 ` Eduardo Mucelli
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=8cd8a184cf719c75403507c186331d12500b803a.1793442331.git.edumucelli@gmail.com \
--to=edumucelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@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®