Re: [PATCH 1/4] tools/bootconfig: Quote event filters in ftrace2bconf.sh
From: Masami Hiramatsu (Google)
Date: Sat Oct 31 2026 - 04:04:31 EST
Hi Eduardo,
On Fri, 30 Oct 2026 13:51:48 +0100, Eduardo Mucelli Rezende Oliveira <edumucelli@xxxxxxxxx> wrote:
> diff --git a/tools/bootconfig/scripts/ftrace2bconf.sh b/tools/bootconfig/scripts/ftrace2bconf.sh
> --- a/tools/bootconfig/scripts/ftrace2bconf.sh
> +++ b/tools/bootconfig/scripts/ftrace2bconf.sh
> @@ -126,6 +126,14 @@ per_event_options() { # event-dir
> val=`cat $evdir/filter`
> if [ "$val" != "none" ]; then
> + case "$val" in
> + *[',;#}']*)
This expression is a bit complicated. Could you explictly escape the "#" and "}"
as "*[,;\#\}]*" ?
> + case "$val" in
> + *\"*) val="'$val'";;
If an event filter contains delimiters alongside both double and single quotes
(e.g. `prev_comm == "a,b" && next_comm == 'c'`), matching `*\"*` unconditionally
encloses `$val` in single quotes `'...'`. Because the value itself already contains
single quotes, this produces an unescaped single quote that will break bootconfig
parsing at boot time ("No value delimiter" / "No closing quotes").
Since bootconfig does not support escape sequences, such filters cannot be
represented when delimiters are present. Rather than outputting malformed
bootconfig, please detect expressions containing both quote types
(`*\"*\'*|*\'*\"*`) when delimiters are matched and emit a warning to stderr
(`# WARN: ...`) similar to other unsupported ftrace options in this script.
Thank you,
> + *) val="\"$val\"";;
> + esac
> + ;;
--
Masami Hiramatsu (Google) <mhiramat@xxxxxxxxxx>