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 mergedc83a80d8b8fix, the upstream build id code was refactored and returns proper build id. Acked-by: Andrii Nakryiko <andrii@kernel.org> Fixes:c83a80d8b8("lib/buildid: harden build ID parsing logic") Signed-off-by: Jiri Olsa <jolsa@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
0c623f5692
commit
efb258ec33
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user