diff options
| author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2026-07-27 13:17:01 -0300 |
|---|---|---|
| committer | Namhyung Kim <namhyung@kernel.org> | 2026-08-03 12:42:49 -0700 |
| commit | ab9c84d1cd59e6b3b73de34982a35a76e3a9b032 (patch) | |
| tree | d36f961b855d87aee1d2b0fe602dedce61481a4c /scripts/patch-kernel | |
| parent | 5a3e6136e31c47837afacb44415415c39b564dc5 (diff) | |
| download | linux-ab9c84d1cd59e6b3b73de34982a35a76e3a9b032.tar.gz linux-ab9c84d1cd59e6b3b73de34982a35a76e3a9b032.zip | |
perf thread-stack: Fix heap buffer overflow on branch stack wrap copy
thread_stack__br_sample() copies the wrap-around portion of the branch
stack ring buffer with:
nr = min(ts->br_stack_pos, sz);
memcpy(be, &src->entries[0], bsz * ts->br_stack_pos);
'nr' is correctly bounded to min(br_stack_pos, sz) but the memcpy uses
the unbounded ts->br_stack_pos directly. When br_stack_pos exceeds
the remaining destination space 'sz', this writes past the destination
buffer.
Use 'nr' (the bounded value) in the memcpy size, matching the pattern
of the first memcpy in the same function.
Fixes: 86d67180b920 ("perf thread-stack: Add branch stack support")
Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Assisted-by: Claude:claude-opus-4.6
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Adrian Hunter <adrian.hunter@intel.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Diffstat (limited to 'scripts/patch-kernel')
0 files changed, 0 insertions, 0 deletions
