From 61701c57f343776a7af84ee6bddecd3c39cd61bd Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Fri, 30 May 2025 15:31:14 +0100 Subject: [PATCH] Prevent illegal memory access when generating map file entries for ifuncs removed by garbage collection --- bfd/elf64-x86-64.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 8a36eef9c7d..6867d493469 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -5247,6 +5247,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, + got_offset); if (PLT_LOCAL_IFUNC_P (info, h)) { + if (h->root.u.def.section == NULL) + return false; + info->callbacks->minfo (_("Local IFUNC function `%s' in %pB\n"), h->root.root.string, h->root.u.def.section->owner); @@ -5415,6 +5418,9 @@ elf_x86_64_finish_dynamic_symbol (bfd *output_bfd, } if (SYMBOL_REFERENCES_LOCAL_P (info, h)) { + if (h->root.u.def.section == NULL) + return false; + info->callbacks->minfo (_("Local IFUNC function `%s' in %pB\n"), h->root.root.string, h->root.u.def.section->owner); -- 2.39.5