summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorShashank Mohan Jain <jain.sm@gmail.com>2026-09-26 06:56:48 +0530
committerYury Norov <ynorov@nvidia.com>2026-09-26 10:21:23 -0400
commitc55d102257fa31271c6f11fea595b78c48fd7aa2 (patch)
tree2122f71cdffe7b60b132fa4658041cb4930e1916 /tools/perf/scripts/python
parentbf7e3cb42c8b5d52fa4232c11bae40e9a2509f95 (diff)
downloadlinux-next-c55d102257fa31271c6f11fea595b78c48fd7aa2.tar.gz
linux-next-c55d102257fa31271c6f11fea595b78c48fd7aa2.zip
bitmap: bitmap_parselist(): reject trailing characters after group size
bitmap_parse_region() checks that every region ends at a separator (',', whitespace, '\n' or '\0'), except in the "range:used/group" form: after parsing the group size it returns the pointer to the following character without looking at it. The caller then starts a new region at that character. Before 'N' and 'all' were accepted as region starts this happened to be harmless, because any other character would fail to parse as a new region. Now text directly following the group size is silently parsed as another region: "0-7:1/2N" -> bits 0,2,4,6,7 (nbits = 8), returns 0 "0-7:1/2all" -> all bits set, returns 0 while "0-7N", "5N" or "0-7:1/2x" are correctly rejected with -EINVAL. bitmap_parselist() is documented to return -EINVAL for an invalid character. It parses cpu lists from sysfs, cgroup cpuset files and boot parameters such as isolcpus= and nohz_full=, so a typo there is accepted and yields a different mask than intended. Check for the end of the region after the group size as well, like the other forms do. Fixes: 2c4885d24e64 ("lib: bitmap: support "N" as an alias for size of bitmap") Assisted-by: LLM Signed-off-by: Shashank Mohan Jain <jain.sm@gmail.com> Signed-off-by: Yury Norov <ynorov@nvidia.com>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions