mirror of
https://github.com/opnsense/src.git
synced 2026-06-13 18:50:31 -04:00
Handle kmod local relocation failures gracefully
It is possible for elf_reloc_local() to fail in the unlikely case of an unsupported relocation type. If this occurs, do not continue to process the file. Reviewed by: kib, markj (earlier version) MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D26701
This commit is contained in:
parent
5152b4f74f
commit
44c705cf15
1 changed files with 10 additions and 6 deletions
|
|
@ -1676,9 +1676,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1704,9 +1706,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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue