Author: mhorne
Date: Mon Nov 9 18:07:21 2020
New Revision: 367528
URL: https://svnweb.freebsd.org/changeset/base/367528
Log:
MFC r366526:
Handle kmod local relocation failures gracefully
Modified:
stable/12/sys/kern/link_elf_obj.c
Directory Properties:
stable/12/ (props changed)
Modified: stable/12/sys/kern/link_elf_obj.c
==============================================================================
--- stable/12/sys/kern/link_elf_obj.c Mon Nov 9 15:37:57 2020
(r367527)
+++ stable/12/sys/kern/link_elf_obj.c Mon Nov 9 18:07:21 2020
(r367528)
@@ -1660,9 +1660,11 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs)
if (ELF_ST_BIND(sym->st_info) != STB_LOCAL)
continue;
if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC ||
- elf_is_ifunc_reloc(rel->r_info)) == ifuncs)
- elf_reloc_local(lf, base, rel, ELF_RELOC_REL,
- elf_obj_lookup);
+ elf_is_ifunc_reloc(rel->r_info)) != ifuncs)
+ continue;
+ if (elf_reloc_local(lf, base, rel, ELF_RELOC_REL,
+ elf_obj_lookup) != 0)
+ return (ENOEXEC);
}
}
@@ -1688,9 +1690,11 @@ link_elf_reloc_local(linker_file_t lf, bool ifuncs)
if (ELF_ST_BIND(sym->st_info) != STB_LOCAL)
continue;
if ((ELF_ST_TYPE(sym->st_info) == STT_GNU_IFUNC ||
- elf_is_ifunc_reloc(rela->r_info)) == ifuncs)
- elf_reloc_local(lf, base, rela, ELF_RELOC_RELA,
- elf_obj_lookup);
+ elf_is_ifunc_reloc(rela->r_info)) != ifuncs)
+ continue;
+ if (elf_reloc_local(lf, base, rela, ELF_RELOC_RELA,
+ elf_obj_lookup) != 0)
+ return (ENOEXEC);
}
}
return (0);
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"