From 5cc55117c366c4a57722fcd53eb7eb86e5294386 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 22 May 2023 19:53:38 -0700 Subject: [PATCH] libsysprof-analyze: check cached ELF for build-id/file-inode Just because it's cached doesn't mean we should just trust it. It could have gotten added to the cache previously even though we didn't match. --- src/libsysprof-analyze/sysprof-elf-loader.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-analyze/sysprof-elf-loader.c b/src/libsysprof-analyze/sysprof-elf-loader.c index 72a9f8d8..03684243 100644 --- a/src/libsysprof-analyze/sysprof-elf-loader.c +++ b/src/libsysprof-analyze/sysprof-elf-loader.c @@ -375,7 +375,11 @@ sysprof_elf_loader_load (SysprofElfLoader *self, if (g_hash_table_lookup_extended (self->cache, path, NULL, (gpointer *)&cached_elf)) { if (cached_elf != NULL) - return g_object_ref (cached_elf); + { + if (sysprof_elf_matches (cached_elf, file_inode, build_id)) + return g_object_ref (cached_elf); + } + continue; }