Re: [PATCH v1] perf llvm: Fix inadvertent file creation

From: Arnaldo Carvalho de Melo
Date: Fri Jan 20 2023 - 00:29:21 EST


Em Thu, Jan 19, 2023 at 07:57:19AM -0800, Ian Rogers escreveu:
> On Thu, Jan 5, 2023 at 12:26 AM Ian Rogers <irogers@xxxxxxxxxx> wrote:
> >
> > The LLVM template is first echo-ed into command_out and then
> > command_out executed. The echo surrounds the template with double
> > quotes, however, the template itself may contain quotes. This is
> > generally innocuous but in tools/perf/tests/bpf-script-test-prologue.c
> > we see:
> > ...
> > SEC("func=null_lseek file->f_mode offset orig")
> > ...
> > where the first double quote ends the double quote of the echo, then
> > the > redirects output into a file called f_mode.
> >
> > To avoid this inadvertent behavior substitute redirects and similar
> > characters to be ASCII control codes, then substitute the output in
> > the echo back again.
> >
> > Fixes: 5eab5a7ee032 ("perf llvm: Display eBPF compiling command in debug output")
> > Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>
>
> Ping. Not really a BPF/LLVM fix, it is just doing some string
> manipulation to avoid shell interpretation in the context of making
> BPF/LLVM.

Thanks, applied.

- Arnaldo