The branch main has been updated by royger: URL: https://cgit.FreeBSD.org/src/commit/?id=5e4279a8f35aa4b46debf728d3f743d64f15aaf8
commit 5e4279a8f35aa4b46debf728d3f743d64f15aaf8 Author: Roger Pau Monné <[email protected]> AuthorDate: 2021-08-11 14:55:10 +0000 Commit: Roger Pau Monné <[email protected]> CommitDate: 2021-08-12 07:18:33 +0000 loader: fix multiboot loading on UEFI The Xen kernel has no symbol tables, so calling lookup_symbol against it triggers the following Divide by Zero fault: Loading Xen kernel... /boot/xen data=0x2809c8+0x149638 | !!!! X64 Exception Type - 00(#DE - Divide Error) CPU Apic ID - 00000000 !!!! Fix lookup_symbol to prevent the #DE fault from happening if the symbol table is not loaded and also fix loadfile_raw to mark multiboot kernels as relocatable, since the only multiboot kernel supported is Xen and was already unconditionally booted as relocatable. Fixes: f75caed644a5 ('amd64 UEFI loader: stop copying staging area to 2M physical') Reviewed by: imp, kib Differential Revision: https://reviews.freebsd.org/D31507 --- stand/common/load_elf.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index 9ae91036dbb4..c163b50c9737 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -447,7 +447,7 @@ __elfN(loadfile_raw)(char *filename, uint64_t dest, *result = (struct preloaded_file *)fp; err = 0; #ifdef __amd64__ - fp->f_kernphys_relocatable = is_kernphys_relocatable(&ef); + fp->f_kernphys_relocatable = multiboot || is_kernphys_relocatable(&ef); #endif goto out; @@ -1253,6 +1253,11 @@ __elfN(lookup_symbol)(elf_file_t ef, const char* name, Elf_Sym *symp, char *strp; unsigned long hash; + if (ef->nbuckets == 0) { + printf(__elfN(bad_symtable)); + return ENOENT; + } + hash = elf_hash(name); COPYOUT(&ef->buckets[hash % ef->nbuckets], &symnum, sizeof(symnum)); _______________________________________________ [email protected] mailing list https://lists.freebsd.org/mailman/listinfo/dev-commits-src-main To unsubscribe, send any mail to "[email protected]"
