summaryrefslogtreecommitdiff
path: root/tools/perf/python/stackcollapse.py
diff options
context:
space:
mode:
authorShashank Mohan Jain <jain.sm@gmail.com>2026-09-26 06:56:46 +0530
committerYury Norov <ynorov@nvidia.com>2026-09-26 10:21:23 -0400
commit7cee2fb210a198667d3d4200705215e6f315cab0 (patch)
tree000ce1e462c17a539f66f1953a49eaccb83e5eee /tools/perf/python/stackcollapse.py
parentd267d2f41222912a5f40dc064df64cee57c8bade (diff)
downloadlinux-next-7cee2fb210a198667d3d4200705215e6f315cab0.tar.gz
linux-next-7cee2fb210a198667d3d4200705215e6f315cab0.zip
bitmap: bitmap_parse(): reject non-hex character before 8 digits
bitmap_parse() is documented to return -EINVAL for illegal characters, and it does so everywhere except when the illegal character directly precedes a chunk of exactly eight hex digits. bitmap_get_x32_reverse() parses a chunk from right to left. After it has consumed eight digits it looks at one more character: a hex digit means the chunk is wider than 32 bits and -EOVERFLOW is returned. Any other character is silently consumed as if it were a separator, and the remaining input is parsed as the next chunk. As a result: "x12345678" -> 0x12345678, returns 0 (expected -EINVAL) "1g12345678" -> 0x1_12345678, returns 0 (expected -EINVAL) "0x0000000f" -> 0xf, returns 0, while "0xf" returns -EINVAL bitmap_parse() backs cpumask_parse() and cpumask_parse_user(), so the same inconsistency is visible when writing masks such as /proc/irq/*/smp_affinity or the network queue rps_cpus/xps_cpus files. __bitmap_parse(), which this function replaced in commit 2d6261583be0 ("lib: rework bitmap_parse()"), rejected all three strings with -EINVAL, and a "0x" prefix is accepted today only when exactly eight digits follow it, so no reliably working input is lost. When the loop falls through, *end is known to be a non-separator character inside the buffer, so return -EOVERFLOW if it is a hex digit and -EINVAL otherwise. Fixes: 2d6261583be0 ("lib: rework bitmap_parse()") 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/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions