Skip to contentSkip to conversation

efi/x86: disable instrumentation in EFI runtime handling code

PATCH New Ard Biesheuvel 1 participant 1 message Jan 21, 2020

Subsystems (2)
lore
Share & tools
lore

Ard Biesheuvel

author maintainer
#0 lore raw

PATCH 1/1 efi/x86: disable instrumentation in EFI runtime handling code

We already disable KASAN instrumentation specifically for the EFI routines that are known to dereference memory addresses that KASAN does not know about, avoiding false positive KASAN splats.

However, as it turns out, having GCOV or KASAN instrumentation enabled interferes with the compiler's ability to optimize away function calls that are guarded by IS_ENABLED() checks that should have resulted in those references to have been const-propagated out of existence. But with instrumenation enabled, we may get build errors like

ld: arch/x86/platform/efi/efi_64.o: in function `efi_thunk_set_virtual_address_map':

Quoted 1 line
Quoted 1 line

arch/x86/platform/efi/efi_64.c:560: undefined reference to `__efi64_thunk'

ld: arch/x86/platform/efi/efi_64.o: in function `efi_set_virtual_address_map':

Quoted 2 lines
Quoted 2 lines

arch/x86/platform/efi/efi_64.c:902: undefined reference to `efi_uv1_memmap_phys_prolog'
ld: arch/x86/platform/efi/efi_64.c:921: undefined reference to `efi_uv1_memmap_phys_epilog'

in builds where CONFIG_EFI=y but CONFIG_EFI_MIXED or CONFIG_X86_UV are not defined, even though the invocations are conditional on IS_ENABLED() checks against the respective Kconfig symbols.

So let's disable instrumentation entirely for this subdirectory, which isn't that useful here to begin with.

---
 arch/x86/platform/efi/Makefile | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/platform/efi/Makefile +2 -0
index 7ec3a8b31f8b..84b09c230cbd 100644
@@ -1,5 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 OBJECT_FILES_NON_STANDARD_efi_thunk_$(BITS).o := y
+KASAN_SANITIZE := n
+GCOV_PROFILE := n
 
 obj-$(CONFIG_EFI) 		+= quirks.o efi.o efi_$(BITS).o efi_stub_$(BITS).o
 obj-$(CONFIG_EFI_MIXED)		+= efi_thunk_$(BITS).o
Signature · 1 line
2.17.1