Skip to content
Snippets Groups Projects
user avatar
Andrii Nakryiko authored
[ Upstream commit 905415ff ]

Harden build ID parsing logic, adding explicit READ_ONCE() where it's
important to have a consistent value read and validated just once.

Also, as pointed out by Andi Kleen, we need to make sure that entire ELF
note is within a page bounds, so move the overflow check up and add an
extra note_size boundaries validation.

Fixes tag below points to the code that moved this code into
lib/buildid.c, and then subsequently was used in perf subsystem, making
this code exposed to perf_event_open() users in v5.12+.

Cc: stable@vger.kernel.org
Reviewed-by: default avatarEduard Zingerman <eddyz87@gmail.com>
Reviewed-by: default avatarJann Horn <jannh@google.com>
Suggested-by: default avatarAndi Kleen <ak@linux.intel.com>
Fixes: bd7525da ("bpf: Move stack_map_get_build_id into lib")
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240829174232.3133883-2-andrii@kernel.org


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
8fa2b681
Name Last commit Last update
..