On Mon, Mar 07, 2016 at 06:44:07PM +0000, Konstantin Belousov wrote: > New Revision: 296467 > URL: https://svnweb.freebsd.org/changeset/base/296467 > > Log: > Convert all panics from the link_elf_obj kernel linker for object > files format into printfs and errors to caller. Some leaks of > resources are there, but the same leaks are present in other error > pathes. With the change, the kernel at least boots even when module > with unexpected or corrupted ELF structure is preloaded. > > Modified: head/sys/kern/link_elf_obj.c > ... > @@ -634,8 +645,11 @@ link_elf_load_file(linker_class_t cls, c > ef->relatab = malloc(ef->nrelatab * sizeof(*ef->relatab), > M_LINKER, M_WAITOK | M_ZERO); > > - if (symtabindex == -1) > - panic("lost symbol table index"); > + if (symtabindex == -1) { > + link_elf_error(filename, "lost symbol table index"); > + error = ENOEXEC; > + goto out; > + } > /* Allocate space for and load the symbol table */ > ef->ddbsymcnt = shdr[symtabindex].sh_size / sizeof(Elf_Sym); > ef->ddbsymtab = malloc(shdr[symtabindex].sh_size, M_LINKER, M_WAITOK); > @@ -650,8 +664,11 @@ link_elf_load_file(linker_class_t cls, c > goto out; > } > > - if (symstrindex == -1) > - panic("lost symbol string index"); > + if (symstrindex == -1) { > + link_elf_error(filename, "lost symbol string index"); > + error = ENOEXEC; > + goto out; > + }
PVS Studio reports: /usr/src/sys/kern/link_elf_obj.c:717:1: warning: V547 Expression 'symstrindex == - 1' is always false. Original panic()s were added by peter@ in r129362 (CC'ed). Could one of you guys take a look? Thanks, ./danfe _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"