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 perf intel-pt: Remove stale build comment 2024-12-18 16:24:33 -03:00
libunwind
perf-regs-arch
scripting-engines perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
addr_location.c perf report: Add machine parallelism 2025-02-17 22:00:50 -08:00
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 perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
arm64-frame-pointer-unwind-support.h
auxtrace.c perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
auxtrace.h perf tools: Parse aux-action 2024-12-18 16:24:32 -03:00
block-info.c
block-info.h
block-range.c
block-range.h
bpf_counter_cgroup.c
bpf_counter.c
bpf_counter.h
bpf_ftrace.c perf ftrace: Fix latency stats with BPF 2025-03-13 00:18:10 -07:00
bpf_kwork_top.c perf kwork: Make perf_kwork_add_work a callback 2024-12-18 16:24:33 -03:00
bpf_kwork.c perf kwork: Make perf_kwork_add_work a callback 2024-12-18 16:24:33 -03:00
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 perf record: Fix segfault with --off-cpu when debuginfo is not enabled 2025-01-14 14:57:19 -03:00
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
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 perf build: Add pylint build tests 2025-03-24 09:38:20 -07:00
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 perf python: Add parse_events function 2024-12-18 16:24:33 -03:00
cgroup.h
clockid.c
clockid.h
cloexec.c
cloexec.h
color_config.c perf util: Remove unused perf_color_default_config 2025-03-10 11:31:24 -07:00
color.c
color.h perf util: Remove unused perf_color_default_config 2025-03-10 11:31:24 -07:00
comm.c perf: Always feature test reallocarray 2025-01-31 14:45:19 -08:00
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 perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
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 perf tools: Use symfs when opening debuginfo by path 2025-02-12 19:44:16 -08:00
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_bpf.c
disasm_bpf.h
disasm.c perf annotate: Return errors from disasm_line__parse_powerpc() 2025-03-06 16:52:24 -08:00
disasm.h
dlfilter.c perf script: Move script_fetch_insn to trace-event-scripting.c 2024-12-18 16:24:32 -03:00
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 perf env: Move arch errno function to only use in env 2024-12-18 16:24:33 -03:00
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_config.h perf tools: Add aux-action config term 2024-12-18 16:24:32 -03:00
evsel_fprintf.c
evsel_fprintf.h
evsel.c perf evsel: tp_format accessing improvements 2025-03-11 18:55:37 -07:00
evsel.h perf stat: Changes to event name uniquification 2025-02-04 21:29:13 -08:00
evswitch.c
evswitch.h
expr.c perf tools: Add skip check in tool_pmu__event_to_str() 2025-02-10 11:46:30 -08:00
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_debug.c
genelf.c
genelf.h
generate-cmdlist.sh perf tools: Remove dependency on libaudit 2025-01-10 10:59:42 -03:00
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 perf test: Fix Hwmon PMU test endianess issue 2025-02-04 17:22:40 -08:00
intel-bts.c perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
intel-bts.h
intel-pt.c perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
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 perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
jitdump.h
kvm-stat.c perf kvm: Move functions used in util out of builtin 2024-12-18 16:24:32 -03:00
kvm-stat.h perf kvm: Move functions used in util out of builtin 2024-12-18 16:24:32 -03:00
kwork.h perf kwork: Make perf_kwork_add_work a callback 2024-12-18 16:24:33 -03:00
levenshtein.c
levenshtein.h
llvm-c-helpers.cpp perf llvm-add2line: Remove unused symbol_conf.h include 2025-01-08 17:38:32 -03:00
llvm-c-helpers.h
lock-contention.c perf lock: Move common lock contention code to new file 2024-12-18 16:24:33 -03:00
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 perf report: Add machine parallelism 2025-02-17 22:00:50 -08:00
map_symbol.c
map_symbol.h
map.c
map.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 perf tools: Deadcode removal 2025-02-10 11:46:02 -08:00
mutex.c
mutex.h perf mutex: Add annotations for LOCKS_EXCLUDED and LOCKS_RETURNED 2025-03-17 22:07:18 -07:00
namespaces.c perf namespaces: Fixup the nsinfo__in_pidns() return type, its bool 2025-01-08 17:31:06 -03:00
namespaces.h perf namespaces: Fixup the nsinfo__in_pidns() return type, its bool 2025-01-08 17:31:06 -03:00
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 perf tools: Add aux-action config term 2024-12-18 16:24:32 -03:00
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 perf path: Remove unused is_executable_file() 2024-12-23 13:53:08 -03:00
path.h perf path: Remove unused is_executable_file() 2024-12-23 13:53:08 -03:00
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
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
PERF-VERSION-GEN
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_binary.c
print_binary.h
print_insn.c
print_insn.h
print-events.c
print-events.h
probe-event.c perf probe: Rename err label 2025-01-14 14:57:19 -03:00
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 perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
s390-cpumsf.h
s390-sample-raw.c
sample-raw.c
sample-raw.h
sample.c perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
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 perf stat: Fix find_stat for mixed legacy/non-legacy events 2025-01-29 14:06:25 -08:00
stat.c perf stat: Don't merge counters purely on name 2025-02-04 21:29:05 -08:00
stat.h perf stat: Move stat_config into config.c 2024-12-18 16:24:32 -03:00
strbuf.c
strbuf.h
stream.c perf stream: Use evsel rather than evsel->idx 2024-12-23 13:53:08 -03:00
stream.h perf stream: Use evsel rather than evsel->idx 2024-12-23 13:53:08 -03:00
strfilter.c
strfilter.h
string.c perf string: Avoid undefined NULL+1 2024-12-12 15:53:36 -03:00
string2.h
strlist.c
strlist.h
svghelper.c
svghelper.h
symbol_conf.h perf report: Add --latency flag 2025-02-18 14:04:32 -08:00
symbol_fprintf.c
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
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_map.c
thread_map.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
threads.c
threads.h
time-utils.c
time-utils.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
tool.c
tool.h
top.c
top.h
topdown.c
topdown.h
trace_augment.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
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 perf sample: Make user_regs and intr_regs optional 2025-02-12 20:06:11 -08:00
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 perf values: Use evsel rather than evsel->idx 2024-12-23 13:53:08 -03:00
values.h perf values: Use evsel rather than evsel->idx 2024-12-23 13:53:08 -03:00
vdso.c
vdso.h
zlib.c
zstd.c