Commit adc1e5c6 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'efi-fixes-for-v7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi

Pull EFI fixes from Ard Biesheuvel:

 - Fix issues in EFI graceful recovery on x86 introduced by changes to
   the kernel mode FPU APIs

 - I-cache coherency fixes for the LoongArch EFI stub

 - Locking fix for EFI pstore

 - Code tweak for efivarfs

* tag 'efi-fixes-for-v7.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/efi/efi:
  x86/efi: Restore IRQ state in EFI page fault handler
  x86/efi: Fix graceful fault handling after FPU softirq changes
  efi/libstub: Synchronize instruction cache after kernel relocation
  efi/loongarch: Implement efi_cache_sync_image()
  efi/libstub: Move efi_relocate_kernel() into its only remaining user
  efi: pstore: Drop efivar lock when efi_pstore_open() returns with an error
  efivarfs: use QSTR() in efivarfs_alloc_dentry
parents e8094806 2c340aab
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -137,7 +137,8 @@ extern void __init efi_dump_pagetable(void);
extern void __init efi_apply_memmap_quirks(void);
extern int __init efi_reuse_config(u64 tables, int nr_tables);
extern void efi_delete_dummy_variable(void);
extern void efi_crash_gracefully_on_page_fault(unsigned long phys_addr);
extern void efi_crash_gracefully_on_page_fault(unsigned long phys_addr,
					       const struct pt_regs *regs);
extern void efi_unmap_boot_services(void);

void arch_efi_call_virt_setup(void);
+1 −1
Original line number Diff line number Diff line
@@ -686,7 +686,7 @@ page_fault_oops(struct pt_regs *regs, unsigned long error_code,
	 * avoid hanging the system.
	 */
	if (IS_ENABLED(CONFIG_EFI))
		efi_crash_gracefully_on_page_fault(address);
		efi_crash_gracefully_on_page_fault(address, regs);

	/* Only not-present faults should be handled by KFENCE. */
	if (!(error_code & X86_PF_PROT) &&
+11 −2
Original line number Diff line number Diff line
@@ -761,7 +761,8 @@ int efi_capsule_setup_info(struct capsule_info *cap_info, void *kbuff,
 * @return: Returns, if the page fault is not handled. This function
 * will never return if the page fault is handled successfully.
 */
void efi_crash_gracefully_on_page_fault(unsigned long phys_addr)
void efi_crash_gracefully_on_page_fault(unsigned long phys_addr,
					const struct pt_regs *regs)
{
	if (!IS_ENABLED(CONFIG_X86_64))
		return;
@@ -770,7 +771,7 @@ void efi_crash_gracefully_on_page_fault(unsigned long phys_addr)
	 * If we get an interrupt/NMI while processing an EFI runtime service
	 * then this is a regular OOPS, not an EFI failure.
	 */
	if (in_interrupt())
	if (!in_task())
		return;

	/*
@@ -810,6 +811,14 @@ void efi_crash_gracefully_on_page_fault(unsigned long phys_addr)
		return;
	}

	/*
	 * The API does not permit entering a kernel mode FPU section with
	 * interrupts enabled and leaving it with interrupts disabled.  So
	 * re-enable interrupts now if they were enabled when the page fault
	 * occurred.
	 */
	local_irq_restore(regs->flags);

	/*
	 * Before calling EFI Runtime Service, the kernel has switched the
	 * calling process to efi_mm. Hence, switch back to task_mm.
+3 −1
Original line number Diff line number Diff line
@@ -60,8 +60,10 @@ static int efi_pstore_open(struct pstore_info *psi)
		return err;

	psi->data = kzalloc(record_size, GFP_KERNEL);
	if (!psi->data)
	if (!psi->data) {
		efivar_unlock();
		return -ENOMEM;
	}

	return 0;
}
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
lib-y				:= efi-stub-helper.o gop.o secureboot.o tpm.o \
				   file.o mem.o random.o randomalloc.o pci.o \
				   skip_spaces.o lib-cmdline.o lib-ctype.o \
				   alignedmem.o relocate.o printk.o vsprintf.o
				   alignedmem.o printk.o vsprintf.o

# include the stub's libfdt dependencies from lib/ when needed
libfdt-deps			:= fdt_rw.c fdt_ro.c fdt_wip.c fdt.c \
Loading