Merge tag 'efi_updates_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Dec 2020 20:40:07 +0000 (12:40 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Dec 2020 20:40:07 +0000 (12:40 -0800)
Pull EFI updates from Borislav Petkov:
 "These got delayed due to a last minute ia64 build issue which got
  fixed in the meantime.

  EFI updates collected by Ard Biesheuvel:

   - Don't move BSS section around pointlessly in the x86 decompressor

   - Refactor helper for discovering the EFI secure boot mode

   - Wire up EFI secure boot to IMA for arm64

   - Some fixes for the capsule loader

   - Expose the RT_PROP table via the EFI test module

   - Relax DT and kernel placement restrictions on ARM

  with a few followup fixes:

   - fix the build breakage on IA64 caused by recent capsule loader
     changes

   - suppress a type mismatch build warning in the expansion of
     EFI_PHYS_ALIGN on ARM"

* tag 'efi_updates_for_v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  efi: arm: force use of unsigned type for EFI_PHYS_ALIGN
  efi: ia64: disable the capsule loader
  efi: stub: get rid of efi_get_max_fdt_addr()
  efi/efi_test: read RuntimeServicesSupported
  efi: arm: reduce minimum alignment of uncompressed kernel
  efi: capsule: clean scatter-gather entries from the D-cache
  efi: capsule: use atomic kmap for transient sglist mappings
  efi: x86/xen: switch to efi_get_secureboot_mode helper
  arm64/ima: add ima_arch support
  ima: generalize x86/EFI arch glue for other EFI architectures
  efi: generalize efi_get_secureboot
  efi/libstub: EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER should not default to yes
  efi/x86: Only copy the compressed kernel image in efi_relocate_kernel()
  efi/libstub/x86: simplify efi_is_native()

1  2 
arch/arm64/Kconfig
arch/x86/boot/compressed/Makefile
drivers/firmware/efi/Kconfig

diff --combined arch/arm64/Kconfig
@@@ -13,6 -13,7 +13,6 @@@ config ARM6
        select ARCH_BINFMT_ELF_STATE
        select ARCH_HAS_DEBUG_VIRTUAL
        select ARCH_HAS_DEBUG_VM_PGTABLE
 -      select ARCH_HAS_DEVMEM_IS_ALLOWED
        select ARCH_HAS_DMA_PREP_COHERENT
        select ARCH_HAS_ACPI_TABLE_UPGRADE if ACPI
        select ARCH_HAS_FAST_MULTIPLIER
@@@ -70,7 -71,6 +70,7 @@@
        select ARCH_USE_QUEUED_RWLOCKS
        select ARCH_USE_QUEUED_SPINLOCKS
        select ARCH_USE_SYM_ANNOTATIONS
 +      select ARCH_SUPPORTS_DEBUG_PAGEALLOC
        select ARCH_SUPPORTS_MEMORY_FAILURE
        select ARCH_SUPPORTS_SHADOW_CALL_STACK if CC_HAVE_SHADOW_CALL_STACK
        select ARCH_SUPPORTS_ATOMIC_RMW
@@@ -81,7 -81,6 +81,7 @@@
        select ARCH_WANT_DEFAULT_TOPDOWN_MMAP_LAYOUT
        select ARCH_WANT_FRAME_POINTERS
        select ARCH_WANT_HUGE_PMD_SHARE if ARM64_4K_PAGES || (ARM64_16K_PAGES && !ARM64_VA_BITS_36)
 +      select ARCH_WANT_LD_ORPHAN_WARN
        select ARCH_HAS_UBSAN_SANITIZE_ALL
        select ARM_AMBA
        select ARM_ARCH_TIMER
        select FRAME_POINTER
        select GENERIC_ALLOCATOR
        select GENERIC_ARCH_TOPOLOGY
 -      select GENERIC_CLOCKEVENTS
        select GENERIC_CLOCKEVENTS_BROADCAST
        select GENERIC_CPU_AUTOPROBE
        select GENERIC_CPU_VULNERABILITIES
        select GENERIC_IRQ_PROBE
        select GENERIC_IRQ_SHOW
        select GENERIC_IRQ_SHOW_LEVEL
 +      select GENERIC_LIB_DEVMEM_IS_ALLOWED
        select GENERIC_PCI_IOMAP
        select GENERIC_PTDUMP
        select GENERIC_SCHED_CLOCK
        select HANDLE_DOMAIN_IRQ
        select HARDIRQS_SW_RESEND
        select HAVE_MOVE_PMD
 +      select HAVE_MOVE_PUD
        select HAVE_PCI
        select HAVE_ACPI_APEI if (ACPI && EFI)
        select HAVE_ALIGNED_STRUCT_PAGE if SLUB
        select HAVE_ARCH_JUMP_LABEL_RELATIVE
        select HAVE_ARCH_KASAN if !(ARM64_16K_PAGES && ARM64_VA_BITS_48)
        select HAVE_ARCH_KASAN_SW_TAGS if HAVE_ARCH_KASAN
 +      select HAVE_ARCH_KASAN_HW_TAGS if (HAVE_ARCH_KASAN && ARM64_MTE)
        select HAVE_ARCH_KGDB
        select HAVE_ARCH_MMAP_RND_BITS
        select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT
 +      select HAVE_ARCH_PFN_VALID
        select HAVE_ARCH_PREL32_RELOCATIONS
        select HAVE_ARCH_SECCOMP_FILTER
        select HAVE_ARCH_STACKLEAK
        select HAVE_NMI
        select HAVE_PATA_PLATFORM
        select HAVE_PERF_EVENTS
 +      select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI && HW_PERF_EVENTS
 +      select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
        select HAVE_PERF_REGS
        select HAVE_PERF_USER_STACK_DUMP
        select HAVE_REGS_AND_STACK_ACCESS_API
        select PCI_SYSCALL if PCI
        select POWER_RESET
        select POWER_SUPPLY
 -      select SET_FS
        select SPARSE_IRQ
        select SWIOTLB
        select SYSCTL_EXCEPTION_TRACE
@@@ -335,17 -330,17 +335,17 @@@ config BROKEN_GAS_INS
  
  config KASAN_SHADOW_OFFSET
        hex
 -      depends on KASAN
 -      default 0xdfffa00000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && !KASAN_SW_TAGS
 -      default 0xdfffd00000000000 if ARM64_VA_BITS_47 && !KASAN_SW_TAGS
 -      default 0xdffffe8000000000 if ARM64_VA_BITS_42 && !KASAN_SW_TAGS
 -      default 0xdfffffd000000000 if ARM64_VA_BITS_39 && !KASAN_SW_TAGS
 -      default 0xdffffffa00000000 if ARM64_VA_BITS_36 && !KASAN_SW_TAGS
 -      default 0xefff900000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && KASAN_SW_TAGS
 -      default 0xefffc80000000000 if ARM64_VA_BITS_47 && KASAN_SW_TAGS
 -      default 0xeffffe4000000000 if ARM64_VA_BITS_42 && KASAN_SW_TAGS
 -      default 0xefffffc800000000 if ARM64_VA_BITS_39 && KASAN_SW_TAGS
 -      default 0xeffffff900000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
 +      depends on KASAN_GENERIC || KASAN_SW_TAGS
 +      default 0xdfff800000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && !KASAN_SW_TAGS
 +      default 0xdfffc00000000000 if ARM64_VA_BITS_47 && !KASAN_SW_TAGS
 +      default 0xdffffe0000000000 if ARM64_VA_BITS_42 && !KASAN_SW_TAGS
 +      default 0xdfffffc000000000 if ARM64_VA_BITS_39 && !KASAN_SW_TAGS
 +      default 0xdffffff800000000 if ARM64_VA_BITS_36 && !KASAN_SW_TAGS
 +      default 0xefff800000000000 if (ARM64_VA_BITS_48 || ARM64_VA_BITS_52) && KASAN_SW_TAGS
 +      default 0xefffc00000000000 if ARM64_VA_BITS_47 && KASAN_SW_TAGS
 +      default 0xeffffe0000000000 if ARM64_VA_BITS_42 && KASAN_SW_TAGS
 +      default 0xefffffc000000000 if ARM64_VA_BITS_39 && KASAN_SW_TAGS
 +      default 0xeffffff800000000 if ARM64_VA_BITS_36 && KASAN_SW_TAGS
        default 0xffffffffffffffff
  
  source "arch/arm64/Kconfig.platforms"
@@@ -641,26 -636,6 +641,26 @@@ config ARM64_ERRATUM_154241
  
          If unsure, say Y.
  
 +config ARM64_ERRATUM_1508412
 +      bool "Cortex-A77: 1508412: workaround deadlock on sequence of NC/Device load and store exclusive or PAR read"
 +      default y
 +      help
 +        This option adds a workaround for Arm Cortex-A77 erratum 1508412.
 +
 +        Affected Cortex-A77 cores (r0p0, r1p0) could deadlock on a sequence
 +        of a store-exclusive or read of PAR_EL1 and a load with device or
 +        non-cacheable memory attributes. The workaround depends on a firmware
 +        counterpart.
 +
 +        KVM guests must also have the workaround implemented or they can
 +        deadlock the system.
 +
 +        Work around the issue by inserting DMB SY barriers around PAR_EL1
 +        register reads and warning KVM users. The DMB barrier is sufficient
 +        to prevent a speculative PAR_EL1 read.
 +
 +        If unsure, say Y.
 +
  config CAVIUM_ERRATUM_22375
        bool "Cavium erratum 22375, 24313"
        default y
@@@ -1007,7 -982,7 +1007,7 @@@ config NUM
  config NODES_SHIFT
        int "Maximum NUMA Nodes (as a power of 2)"
        range 1 10
 -      default "2"
 +      default "4"
        depends on NEED_MULTIPLE_NODES
        help
          Specify the maximum number of NUMA Nodes available on the target
@@@ -1030,6 -1005,9 +1030,6 @@@ config HOLES_IN_ZON
  
  source "kernel/Kconfig.hz"
  
 -config ARCH_SUPPORTS_DEBUG_PAGEALLOC
 -      def_bool y
 -
  config ARCH_SPARSEMEM_ENABLE
        def_bool y
        select SPARSEMEM_VMEMMAP_ENABLE
@@@ -1043,6 -1021,9 +1043,6 @@@ config ARCH_SELECT_MEMORY_MODE
  config ARCH_FLATMEM_ENABLE
        def_bool !NUMA
  
 -config HAVE_ARCH_PFN_VALID
 -      def_bool y
 -
  config HW_PERF_EVENTS
        def_bool y
        depends on ARM_PMU
@@@ -1387,9 -1368,6 +1387,9 @@@ config ARM64_PA
         The feature is detected at runtime, and will remain as a 'nop'
         instruction if the cpu does not implement the feature.
  
 +config AS_HAS_LDAPR
 +      def_bool $(as-instr,.arch_extension rcpc)
 +
  config ARM64_LSE_ATOMICS
        bool
        default ARM64_USE_LSE_ATOMICS
@@@ -1427,6 -1405,27 +1427,6 @@@ endmen
  
  menu "ARMv8.2 architectural features"
  
 -config ARM64_UAO
 -      bool "Enable support for User Access Override (UAO)"
 -      default y
 -      help
 -        User Access Override (UAO; part of the ARMv8.2 Extensions)
 -        causes the 'unprivileged' variant of the load/store instructions to
 -        be overridden to be privileged.
 -
 -        This option changes get_user() and friends to use the 'unprivileged'
 -        variant of the load/store instructions. This ensures that user-space
 -        really did have access to the supplied memory. When addr_limit is
 -        set to kernel memory the UAO bit will be set, allowing privileged
 -        access to kernel memory.
 -
 -        Choosing this option will cause copy_to_user() et al to use user-space
 -        memory permissions.
 -
 -        The feature is detected at runtime, the kernel will use the
 -        regular load/store instructions if the cpu does not implement the
 -        feature.
 -
  config ARM64_PMEM
        bool "Enable support for persistent memory"
        select ARCH_HAS_PMEM_API
@@@ -1572,9 -1571,6 +1572,9 @@@ endmen
  
  menu "ARMv8.5 architectural features"
  
 +config AS_HAS_ARMV8_5
 +      def_bool $(cc-option,-Wa$(comma)-march=armv8.5-a)
 +
  config ARM64_BTI
        bool "Branch Target Identification support"
        default y
@@@ -1649,9 -1645,6 +1649,9 @@@ config ARM64_MT
        bool "Memory Tagging Extension support"
        default y
        depends on ARM64_AS_HAS_MTE && ARM64_TAGGED_ADDR_ABI
 +      depends on AS_HAS_ARMV8_5
 +      # Required for tag checking in the uaccess routines
 +      depends on ARM64_PAN
        select ARCH_USES_HIGH_VMA_FLAGS
        help
          Memory Tagging (part of the ARMv8.5 Extensions) provides
@@@ -1833,36 -1826,15 +1833,36 @@@ config CMDLIN
          entering them here. As a minimum, you should specify the the
          root device (e.g. root=/dev/nfs).
  
 +choice
 +      prompt "Kernel command line type" if CMDLINE != ""
 +      default CMDLINE_FROM_BOOTLOADER
 +      help
 +        Choose how the kernel will handle the provided default kernel
 +        command line string.
 +
 +config CMDLINE_FROM_BOOTLOADER
 +      bool "Use bootloader kernel arguments if available"
 +      help
 +        Uses the command-line options passed by the boot loader. If
 +        the boot loader doesn't provide any, the default kernel command
 +        string provided in CMDLINE will be used.
 +
 +config CMDLINE_EXTEND
 +      bool "Extend bootloader kernel arguments"
 +      help
 +        The command-line arguments provided by the boot loader will be
 +        appended to the default kernel command string.
 +
  config CMDLINE_FORCE
        bool "Always use the default kernel command string"
 -      depends on CMDLINE != ""
        help
          Always use the default kernel command string, even if the boot
          loader passes other arguments to the kernel.
          This is useful if you cannot or don't want to change the
          command-line options your boot loader passes to the kernel.
  
 +endchoice
 +
  config EFI_STUB
        bool
  
@@@ -1877,6 -1849,7 +1877,7 @@@ config EF
        select EFI_RUNTIME_WRAPPERS
        select EFI_STUB
        select EFI_GENERIC_STUB
+       imply IMA_SECURE_AND_OR_TRUSTED_BOOT
        default y
        help
          This option provides support for runtime services provided
@@@ -35,7 -35,7 +35,7 @@@ cflags-$(CONFIG_X86_32) := -march=i38
  cflags-$(CONFIG_X86_64) := -mcmodel=small -mno-red-zone
  KBUILD_CFLAGS += $(cflags-y)
  KBUILD_CFLAGS += -mno-mmx -mno-sse
- KBUILD_CFLAGS += -ffreestanding
+ KBUILD_CFLAGS += -ffreestanding -fshort-wchar
  KBUILD_CFLAGS += -fno-stack-protector
  KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
  KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
@@@ -61,9 -61,7 +61,9 @@@ KBUILD_LDFLAGS += $(call ld-option,--no
  # Compressed kernel should be built as PIE since it may be loaded at any
  # address by the bootloader.
  LDFLAGS_vmlinux := -pie $(call ld-option, --no-dynamic-linker)
 -LDFLAGS_vmlinux += $(call ld-option, --orphan-handling=warn)
 +ifdef CONFIG_LD_ORPHAN_WARN
 +LDFLAGS_vmlinux += --orphan-handling=warn
 +endif
  LDFLAGS_vmlinux += -T
  
  hostprogs     := mkpiggy
@@@ -122,7 -122,7 +122,7 @@@ config EFI_ARMSTUB_DTB_LOADE
  config EFI_GENERIC_STUB_INITRD_CMDLINE_LOADER
        bool "Enable the command line initrd loader" if !X86
        depends on EFI_STUB && (EFI_GENERIC_STUB || X86)
-       default y
+       default y if X86
        depends on !RISCV
        help
          Select this config option to add support for the initrd= command
@@@ -147,7 -147,7 +147,7 @@@ config EFI_BOOTLOADER_CONTRO
  
  config EFI_CAPSULE_LOADER
        tristate "EFI capsule loader"
-       depends on EFI
+       depends on EFI && !IA64
        help
          This option exposes a loader interface "/dev/efi_capsule_loader" for
          users to load EFI capsules. This driver requires working runtime
@@@ -270,7 -270,7 +270,7 @@@ config EFI_DEV_PATH_PARSE
  
  config EFI_EARLYCON
        def_bool y
 -      depends on SERIAL_EARLYCON && !ARM && !IA64
 +      depends on EFI && SERIAL_EARLYCON && !ARM && !IA64
        select FONT_SUPPORT
        select ARCH_USE_MEMREMAP_PROT