linux-stable/arch/x86
Ard Biesheuvel 3cc028619e efi/x86: avoid KASAN false positives when accessing the 1: 1 mapping
When installing the EFI virtual address map during early boot, we
access the EFI system table to retrieve the 1:1 mapped address of
the SetVirtualAddressMap() EFI runtime service. This memory is not
known to KASAN, so on KASAN enabled builds, this may result in a
splat like

  ==================================================================
  BUG: KASAN: user-memory-access in efi_set_virtual_address_map+0x141/0x354
  Read of size 4 at addr 000000003fbeef38 by task swapper/0/0

  CPU: 0 PID: 0 Comm: swapper/0 Not tainted 5.5.0-rc5+ #758
  Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
  Call Trace:
   dump_stack+0x8b/0xbb
   ? efi_set_virtual_address_map+0x141/0x354
   ? efi_set_virtual_address_map+0x141/0x354
   __kasan_report+0x176/0x192
   ? efi_set_virtual_address_map+0x141/0x354
   kasan_report+0xe/0x20
   efi_set_virtual_address_map+0x141/0x354
   ? efi_thunk_runtime_setup+0x148/0x148
   ? __inc_numa_state+0x19/0x90
   ? memcpy+0x34/0x50
   efi_enter_virtual_mode+0x5fd/0x67d
   start_kernel+0x5cd/0x682
   ? mem_encrypt_init+0x6/0x6
   ? x86_family+0x5/0x20
   ? load_ucode_bsp+0x46/0x154
   secondary_startup_64+0xa4/0xb0
  ==================================================================

Since this code runs only a single time during early boot, let's annotate
it as __no_sanitize_address so KASAN disregards it entirely.

Fixes: 6982947045 ("efi/x86: Split SetVirtualAddresMap() wrappers into ...")
Reported-by: Qian Cai <cai@lca.pw>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2020-01-20 08:14:29 +01:00
..
boot efi/libstub/x86: Fix unused-variable warning 2020-01-20 08:13:00 +01:00
configs x86: Remove the calgary IOMMU driver 2019-11-15 10:36:59 +01:00
crypto Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 2019-12-02 17:23:21 -08:00
entry Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-12-01 19:05:07 -08:00
events perf/x86/intel/uncore: Remove PCIe3 unit for SNR 2020-01-17 11:33:38 +01:00
hyperv - Support for new VMBus protocols (Andrea Parri). 2019-11-30 14:50:51 -08:00
ia32 syscalls/x86: Use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn 2019-10-11 12:49:18 +02:00
include efi/x86: Limit EFI old memory map to SGI UV machines 2020-01-20 08:13:01 +01:00
kernel efi/x86: Limit EFI old memory map to SGI UV machines 2020-01-20 08:13:01 +01:00
kvm Merge branch 'x86/mm' into efi/core, to pick up dependencies 2020-01-10 18:53:14 +01:00
lib perf/core improvements and fixes: 2019-11-29 06:56:05 +01:00
math-emu Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-11-26 10:42:40 -08:00
mm x86/mm: Fix NX bit clearing issue in kernel_map_pages_in_pgd 2020-01-20 08:13:00 +01:00
net bpf: Simplify __bpf_arch_text_poke poke type handling 2019-11-24 17:12:11 -08:00
oprofile x86: Use pr_warn instead of pr_warning 2019-10-18 15:00:18 +02:00
pci x86/mm/pat: Rename <asm/pat.h> => <asm/memtype.h> 2019-12-10 10:12:55 +01:00
platform efi/x86: avoid KASAN false positives when accessing the 1: 1 mapping 2020-01-20 08:14:29 +01:00
power x86/asm/32: Change all ENTRY+ENDPROC to SYM_FUNC_* 2019-10-18 12:03:43 +02:00
purgatory Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-11-26 10:42:40 -08:00
ras
realmode Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip 2019-11-26 10:42:40 -08:00
tools x86/insn: Fix awk regexp warnings 2019-10-01 12:13:16 +02:00
um um: Implement copy_thread_tls 2020-01-07 13:31:29 +01:00
video
xen Merge branch 'x86/mm' into efi/core, to pick up dependencies 2020-01-10 18:53:14 +01:00
.gitignore
Kbuild
Kconfig Merge branch 'x86/mm' into efi/core, to pick up dependencies 2020-01-10 18:53:14 +01:00
Kconfig.cpu x86/math-emu: Limit MATH_EMULATION to 486SX compatibles 2019-10-03 10:51:17 +02:00
Kconfig.debug x86/traps: Disentangle the 32-bit and 64-bit doublefault code 2019-11-26 21:53:34 +01:00
Makefile x86/build: Add -Wnoaddress-of-packed-member to REALMODE_CFLAGS, to silence GCC9 build warning 2019-08-28 17:31:31 +02:00
Makefile.um
Makefile_32.cpu x86/math-emu: Limit MATH_EMULATION to 486SX compatibles 2019-10-03 10:51:17 +02:00