linux/tools/perf/util
Namhyung Kim 35d13f841a perf bpf-filter: Fix a parsing error with comma
The previous change to support cgroup filters introduced a bug that
pathname can include commas.  It confused the lexer to treat an item and
the trailing comma as a single token.  And it resulted in a parse error:

  $ sudo perf record -e cycles:P --filter 'period > 0, ip > 64' -- true
  perf_bpf_filter: Error: Unexpected item: 0,
  perf_bpf_filter: syntax error, unexpected BFT_ERROR, expecting BFT_NUM

   Usage: perf record [<options>] [<command>]
      or: perf record [<options>] -- <command> [<options>]

          --filter <filter>
                            event filter

It should get "0" and "," separately.

An easiest fix would be to remove "," from the possible pathname
characters.  As it's for cgroup names, probably ok to assume it won't
have commas in the pathname.

I found that the existing BPF filtering test didn't have any complex
filter condition with commas.  Let's update the group filter test which
is supposed to test filter combinations like this.

Link: https://lore.kernel.org/r/20250307220922.434319-1-namhyung@kernel.org
Fixes: 91e88437d5 ("perf bpf-filter: Support filtering on cgroups")
Reported-by: Sally Shi <sshii@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
2025-03-24 17:29:58 -07:00
..
arm-spe-decoder perf arm-spe: Support previous branch target (PBT) address 2025-03-05 09:13:20 -08:00
bpf_skel perf kwork: Remove unreachable judgments 2025-03-18 16:55:30 -07:00
cs-etm-decoder
hisi-ptt-decoder
include
intel-pt-decoder
libunwind
perf-regs-arch
scripting-engines
Build perf build: Add pylint build tests 2025-03-24 09:38:20 -07:00
PERF-VERSION-GEN
addr_location.c
addr_location.h perf report: Add latency output field 2025-02-18 14:04:32 -08:00
affinity.c
affinity.h
amd-sample-raw.c
annotate-data.c perf annotate-data: Add annotated_data_type__get_member_name() 2025-03-13 00:19:51 -07:00
annotate-data.h perf annotate-data: Add annotated_data_type__get_member_name() 2025-03-13 00:19:51 -07:00
annotate.c perf annotate: Implement code + data type annotation 2025-03-13 00:19:51 -07:00
annotate.h perf annotate: Implement code + data type annotation 2025-03-13 00:19:51 -07:00
archinsn.h
arm-spe.c perf arm-spe: Support previous branch target (PBT) address 2025-03-05 09:13:20 -08:00
arm-spe.h
arm64-frame-pointer-unwind-support.c
arm64-frame-pointer-unwind-support.h
auxtrace.c
auxtrace.h
block-info.c
block-info.h
block-range.c
block-range.h
bpf-event.c
bpf-event.h
bpf-filter.c
bpf-filter.h
bpf-filter.l perf bpf-filter: Fix a parsing error with comma 2025-03-24 17:29:58 -07:00
bpf-filter.y
bpf-utils.c
bpf-utils.h
bpf_counter.c
bpf_counter.h
bpf_counter_cgroup.c
bpf_ftrace.c perf ftrace: Fix latency stats with BPF 2025-03-13 00:18:10 -07:00
bpf_kwork.c
bpf_kwork_top.c
bpf_lock_contention.c perf lock: Report owner stack in usermode 2025-02-28 10:09:02 -08:00
bpf_map.c
bpf_map.h
bpf_off_cpu.c
branch.c
branch.h perf script: Add not taken event for branch stack 2025-03-05 09:13:19 -08:00
btf.c
btf.h
build-id.c
build-id.h
cache.h
cacheline.c
cacheline.h
call-path.c
call-path.h
callchain.c perf report: Use map_symbol__copy() when copying callchains 2025-03-07 14:06:56 -08:00
callchain.h
cap.c
cap.h
cgroup.c
cgroup.h
clockid.c
clockid.h
cloexec.c
cloexec.h
color.c
color.h perf util: Remove unused perf_color_default_config 2025-03-10 11:31:24 -07:00
color_config.c perf util: Remove unused perf_color_default_config 2025-03-10 11:31:24 -07:00
comm.c
comm.h
compress.h perf tools: Add LZMA decompression from FILE 2025-03-10 14:37:02 -07:00
config.c perf util: Remove unused perf_config__refresh 2025-03-10 11:31:24 -07:00
config.h perf util: Remove unused perf_config__refresh 2025-03-10 11:31:24 -07:00
copyfile.c
copyfile.h
counts.c
counts.h
cpu-set-sched.h
cpumap.c perf cpumap: Increment reference count for online cpumap 2025-03-19 16:56:33 -07:00
cpumap.h
cputopo.c
cputopo.h
cs-etm-base.c
cs-etm.c
cs-etm.h
data-convert-bt.c
data-convert-json.c
data-convert.h
data.c perf util: Remove unused perf_data__update_dir 2025-03-10 11:31:24 -07:00
data.h perf util: Remove unused perf_data__update_dir 2025-03-10 11:31:24 -07:00
db-export.c
db-export.h
debug.c perf debug: Avoid stack overflow in recursive error message 2025-03-11 18:55:37 -07:00
debug.h
debuginfo.c
debuginfo.h
demangle-cxx.cpp
demangle-cxx.h
demangle-java.c
demangle-java.h
demangle-ocaml.c
demangle-ocaml.h
demangle-rust.c
demangle-rust.h
disasm.c perf annotate: Return errors from disasm_line__parse_powerpc() 2025-03-06 16:52:24 -08:00
disasm.h
disasm_bpf.c
disasm_bpf.h
dlfilter.c
dlfilter.h
dso.c perf dso: Add support for reading the e_machine type for a dso 2025-03-20 22:58:02 -07:00
dso.h perf dso: Add support for reading the e_machine type for a dso 2025-03-20 22:58:02 -07:00
dsos.c
dsos.h
dump-insn.c
dump-insn.h
dwarf-aux.c
dwarf-aux.h
dwarf-regs-csky.c
dwarf-regs-powerpc.c
dwarf-regs-x86.c
dwarf-regs.c
env.c perf cpumap: Reduce cpu size from int to int16_t 2025-02-27 08:47:25 -08:00
env.h
event.c perf report: Add latency output field 2025-02-18 14:04:32 -08:00
event.h perf script: Fix typo in branch event mask 2025-03-13 13:19:27 -07:00
events_stats.h perf report: Add latency output field 2025-02-18 14:04:32 -08:00
evlist.c perf cpumap: Increment reference count for online cpumap 2025-03-19 16:56:33 -07:00
evlist.h perf tools: Skip BPF sideband event for userspace profiling 2025-03-02 09:47:24 -08:00
evsel.c perf evsel: tp_format accessing improvements 2025-03-11 18:55:37 -07:00
evsel.h
evsel_config.h
evsel_fprintf.c
evsel_fprintf.h
evswitch.c
evswitch.h
expr.c
expr.h
expr.l
expr.y
find-map.c
fncache.c
fncache.h
ftrace.h perf ftrace latency: allow to hide empty buckets 2025-02-26 13:48:02 -08:00
genelf.c
genelf.h
genelf_debug.c
generate-cmdlist.sh
get_current_dir_name.c
get_current_dir_name.h
hashmap.c
hashmap.h
header.c perf report: Fix a memory leak for perf_env on AMD 2025-03-24 16:22:06 -07:00
header.h
help-unknown-cmd.c
help-unknown-cmd.h
hisi-ptt.c
hisi-ptt.h
hist.c perf report: Fix memory leaks in the hierarchy mode 2025-03-07 14:07:07 -08:00
hist.h perf hist: Shrink struct hist_entry size 2025-02-18 14:04:32 -08:00
hwmon_pmu.c perf hwmon_pmu: Switch event discovery to io_dir__readdir 2025-02-24 15:46:33 -08:00
hwmon_pmu.h
intel-bts.c
intel-bts.h
intel-pt.c
intel-pt.h
intel-tpebs.c perf: intel-tpebs: Fix incorrect usage of zfree() 2025-03-19 16:56:56 -07:00
intel-tpebs.h
intlist.c
intlist.h
iostat.c
iostat.h
jit.h
jitdump.c
jitdump.h
kvm-stat.c
kvm-stat.h
kwork.h
levenshtein.c
levenshtein.h
llvm-c-helpers.cpp
llvm-c-helpers.h
lock-contention.c
lock-contention.h perf lock: Report owner stack in usermode 2025-02-28 10:09:02 -08:00
lzma.c perf tools: Add LZMA decompression from FILE 2025-03-10 14:37:02 -07:00
machine.c perf report: Do not process non-JIT BPF ksymbol events 2025-03-06 16:00:25 -08:00
machine.h
map.c
map.h
map_symbol.c
map_symbol.h
maps.c perf maps: Add missing map__set_kmap_maps() when replacing a kernel map 2025-03-05 23:03:43 -08:00
maps.h
mem-events.c perf cpumap: Increment reference count for online cpumap 2025-03-19 16:56:33 -07:00
mem-events.h perf mem: Don't leak mem event names 2025-03-10 14:26:45 -07:00
mem-info.c
mem-info.h
mem2node.c
mem2node.h
memswap.c
memswap.h
metricgroup.c
metricgroup.h
mmap.c perf cpumap: Increment reference count for online cpumap 2025-03-19 16:56:33 -07:00
mmap.h
mutex.c
mutex.h perf mutex: Add annotations for LOCKS_EXCLUDED and LOCKS_RETURNED 2025-03-17 22:07:18 -07:00
namespaces.c
namespaces.h
off_cpu.h
ordered-events.c
ordered-events.h
parse-branch-options.c
parse-branch-options.h
parse-events.c perf parse-events: Corrections to topdown sorting 2025-03-11 19:00:50 -07:00
parse-events.h
parse-events.l perf parse-events: Tidy name token matching 2025-02-20 22:35:10 -08:00
parse-events.y
parse-regs-options.c
parse-regs-options.h
parse-sublevel-options.c
parse-sublevel-options.h
path.c
path.h
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
perf_api_probe.c
perf_api_probe.h
perf_event_attr_fprintf.c perf tools: Improve handling of hybrid PMUs in perf_event_attr__fprintf 2025-03-11 19:00:50 -07:00
perf_regs.c
perf_regs.h
pfm.c
pfm.h
pmu.c perf cpumap: Increment reference count for online cpumap 2025-03-19 16:56:33 -07:00
pmu.h perf pmu: Don't double count common sysfs and json events 2025-02-26 16:23:47 -08:00
pmu.l
pmu.y
pmus.c perf pmu: Handle memory failure in tool_pmu__new() 2025-03-19 17:00:16 -07:00
pmus.h perf util: Remove unused perf_pmus__default_pmu_name 2025-03-10 11:31:24 -07:00
print-events.c
print-events.h
print_binary.c
print_binary.h
print_insn.c
print_insn.h
probe-event.c
probe-event.h
probe-file.c
probe-file.h
probe-finder.c perf probe: Pick the correct dwarf die while adding probe points 2025-02-26 14:25:14 -08:00
probe-finder.h perf probe: Pick the correct dwarf die while adding probe points 2025-02-26 14:25:14 -08:00
pstack.c perf util: Remove unused pstack__pop 2025-03-10 11:31:24 -07:00
pstack.h perf util: Remove unused pstack__pop 2025-03-10 11:31:24 -07:00
python.c perf python: Check if there is space to copy all the event 2025-03-18 16:08:45 -07:00
rblist.c
rblist.h
record.c
record.h
rlimit.c
rlimit.h
rwsem.c
rwsem.h
s390-cpumcf-kernel.h
s390-cpumsf-kernel.h
s390-cpumsf.c
s390-cpumsf.h
s390-sample-raw.c
sample-raw.c
sample-raw.h
sample.c
sample.h perf hist: Shrink struct hist_entry size 2025-02-18 14:04:32 -08:00
session.c perf report: Add parallelism sort key 2025-02-17 22:00:50 -08:00
session.h perf report: Add parallelism sort key 2025-02-17 22:00:50 -08:00
setns.c
setup.py perf python: Fix setup.py mypy errors 2025-03-24 09:38:20 -07:00
sharded_mutex.c
sharded_mutex.h
sideband_evlist.c
smt.c
smt.h
sort.c perf sort: Keep output fields in the same level 2025-03-20 09:17:56 -07:00
sort.h perf report: Add --latency flag 2025-02-18 14:04:32 -08:00
spark.c
spark.h
srccode.c
srccode.h
srcline.c
srcline.h
stat-display.c perf stat: Fix non-uniquified hybrid legacy events 2025-03-03 12:48:17 -08:00
stat-shadow.c
stat.c
stat.h
strbuf.c
strbuf.h
stream.c
stream.h
strfilter.c
strfilter.h
string.c
string2.h
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol-elf.c perf dso: Add support for reading the e_machine type for a dso 2025-03-20 22:58:02 -07:00
symbol-minimal.c
symbol.c perf symbol: Support .gnu_debugdata for symbols 2025-03-10 14:37:06 -07:00
symbol.h
symbol_conf.h perf report: Add --latency flag 2025-02-18 14:04:32 -08:00
symbol_fprintf.c
symsrc.h
synthetic-events.c perf events: Remove scandir in thread synthesis 2025-02-24 15:46:33 -08:00
synthetic-events.h
syscalltbl.c perf syscalltbl: Mask off ABI type for MIPS system calls 2025-03-20 22:58:23 -07:00
syscalltbl.h perf syscalltbl: Remove struct syscalltbl 2025-03-20 22:57:57 -07:00
target.c
target.h
term.c
term.h
thread-stack.c
thread-stack.h
thread.c perf thread: Add support for reading the e_machine type for a thread 2025-03-20 22:58:05 -07:00
thread.h perf thread: Add support for reading the e_machine type for a thread 2025-03-20 22:58:05 -07:00
thread_map.c
thread_map.h
threads.c
threads.h
time-utils.c
time-utils.h
tool.c
tool.h
tool_pmu.c perf pmu: Handle memory failure in tool_pmu__new() 2025-03-19 17:00:16 -07:00
tool_pmu.h perf pmu: Dynamically allocate tool PMU 2025-02-26 16:23:47 -08:00
top.c
top.h
topdown.c
topdown.h
trace-event-info.c
trace-event-parse.c
trace-event-read.c
trace-event-scripting.c perf script: Fix typo in branch event mask 2025-03-13 13:19:27 -07:00
trace-event.c
trace-event.h perf script: Make printing flags reliable 2025-03-05 09:13:19 -08:00
trace_augment.h
tracepoint.c
tracepoint.h
trigger.h
tsc.c
tsc.h
units.c perf units: Fix insufficient array space 2025-03-13 00:30:08 -07:00
units.h
unwind-libdw.c
unwind-libdw.h
unwind-libunwind-local.c perf dso: Use lock annotations to fix asan deadlock 2025-03-17 22:07:18 -07:00
unwind-libunwind.c
unwind.h
usage.c
util.c
util.h
values.c
values.h
vdso.c
vdso.h
zlib.c
zstd.c