git: d9da2f90cbec - stable/13 - loader: Relax the check in is_kernphys_relocatable()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 15 Jul 2022 16:34:02 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=d9da2f90cbec9b3c4777bd12671e2f837907ff5a

commit d9da2f90cbec9b3c4777bd12671e2f837907ff5a
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-06-15 14:47:13 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-07-15 16:33:03 +0000

    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
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 9a964ad56182740ea09b87f7e6db4197c6756e48)
---
 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 c75567b4a560..d8fad9df994b 100644
--- a/stand/common/load_elf.c
+++ b/stand/common/load_elf.c
@@ -214,8 +214,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