diff options
author | Jiri Olsa <jolsa@kernel.org> | 2024-11-04 18:52:55 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-11-22 15:38:36 +0100 |
commit | efb258ec337f34962606620fe0f77808edf9f92d (patch) | |
tree | 65dc85286a29aa60ed1b9327917823d05685fb3f /lib | |
parent | 0c623f5692a0f9e77c2e2aea487b353fd235306d (diff) | |
download | linux-efb258ec337f34962606620fe0f77808edf9f92d.tar.gz linux-efb258ec337f34962606620fe0f77808edf9f92d.tar.bz2 linux-efb258ec337f34962606620fe0f77808edf9f92d.zip |
lib/buildid: Fix build ID parsing logic
The parse_build_id_buf does not account Elf32_Nhdr header size
when getting the build id data pointer and returns wrong build
id data as result.
This is problem only for stable trees that merged c83a80d8b84f
fix, the upstream build id code was refactored and returns proper
build id.
Acked-by: Andrii Nakryiko <andrii@kernel.org>
Fixes: c83a80d8b84f ("lib/buildid: harden build ID parsing logic")
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/buildid.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/buildid.c b/lib/buildid.c index d3bc3d0528d5..9fc46366597e 100644 --- a/lib/buildid.c +++ b/lib/buildid.c @@ -40,7 +40,7 @@ static int parse_build_id_buf(unsigned char *build_id, name_sz == note_name_sz && memcmp(nhdr + 1, note_name, note_name_sz) == 0 && desc_sz > 0 && desc_sz <= BUILD_ID_SIZE_MAX) { - data = note_start + note_off + ALIGN(note_name_sz, 4); + data = note_start + note_off + sizeof(Elf32_Nhdr) + ALIGN(note_name_sz, 4); memcpy(build_id, data, desc_sz); memset(build_id + desc_sz, 0, BUILD_ID_SIZE_MAX - desc_sz); if (size) |