mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 18:13:41 +02:00
perf build-id: Truncate to avoid overflowing the build_id data
Warning when the build_id data would be overflowed would lead to memory corruption, switch to truncation. Signed-off-by: Ian Rogers <irogers@google.com> Link: https://lore.kernel.org/r/20250724163302.596743-3-irogers@google.com Signed-off-by: Namhyung Kim <namhyung@kernel.org>
This commit is contained in:
parent
f3982385bc
commit
5a2ceebd81
|
|
@ -951,7 +951,10 @@ bool perf_session__read_build_ids(struct perf_session *session, bool with_hits)
|
|||
|
||||
void build_id__init(struct build_id *bid, const u8 *data, size_t size)
|
||||
{
|
||||
WARN_ON(size > BUILD_ID_SIZE);
|
||||
if (size > BUILD_ID_SIZE) {
|
||||
pr_debug("Truncating build_id size from %zd\n", size);
|
||||
size = BUILD_ID_SIZE;
|
||||
}
|
||||
memcpy(bid->data, data, size);
|
||||
bid->size = size;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user