From 9a964ad56182740ea09b87f7e6db4197c6756e48 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Wed, 15 Jun 2022 10:47:13 -0400 Subject: [PATCH] loader: Relax the check in is_kernphys_relocatable() The check fails in kernels compiled with KASAN because AddressSanitizer inserts redzones around global variables, so the size of the "kernphys" symbol is 32 rather than 8. Thus we fall back to copying even though it's not necessary. Simply remove the size check. I didn't want to extend the symbol size check since there's no guarantee that AddressSanitizer will always emit 32 bytes for "kernphys". Reviewed by: kib MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D35448 --- stand/common/load_elf.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/stand/common/load_elf.c b/stand/common/load_elf.c index 4a6c1d5f4e7f..fd9985f51bf9 100644 --- a/stand/common/load_elf.c +++ b/stand/common/load_elf.c @@ -211,8 +211,7 @@ is_kernphys_relocatable(elf_file_t ef) { Elf_Sym sym; - return (__elfN(lookup_symbol)(ef, "kernphys", &sym, STT_OBJECT) == 0 && - sym.st_size == 8); + return (__elfN(lookup_symbol)(ef, "kernphys", &sym, STT_OBJECT) == 0); } #endif