Skip to content

Commit 7eb4e1d

Browse files
vianplardbiesheuvel
authored andcommitted
x86/efi: Drop support for the EFI_PROPERTIES_TABLE
Drop support for the EFI_PROPERTIES_TABLE. It was a failed, short-lived experiment that broke the boot both on Linux and Windows, and was replaced by the EFI_MEMORY_ATTRIBUTES_TABLE shortly after. Suggested-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Nicolas Saenz Julienne <nsaenz@amazon.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
1 parent 8fbe4c4 commit 7eb4e1d

3 files changed

Lines changed: 3 additions & 75 deletions

File tree

arch/x86/platform/efi/efi.c

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,12 @@
5454
#include <asm/uv/uv.h>
5555

5656
static unsigned long efi_systab_phys __initdata;
57-
static unsigned long prop_phys = EFI_INVALID_TABLE_ADDR;
5857
static unsigned long uga_phys = EFI_INVALID_TABLE_ADDR;
5958
static unsigned long efi_runtime, efi_nr_tables;
6059

6160
unsigned long efi_fw_vendor, efi_config_table;
6261

6362
static const efi_config_table_type_t arch_tables[] __initconst = {
64-
{EFI_PROPERTIES_TABLE_GUID, &prop_phys, "PROP" },
6563
{UGA_IO_PROTOCOL_GUID, &uga_phys, "UGA" },
6664
#ifdef CONFIG_X86_UV
6765
{UV_SYSTEM_TABLE_GUID, &uv_systab_phys, "UVsystab" },
@@ -82,7 +80,6 @@ static const unsigned long * const efi_tables[] = {
8280
&efi_runtime,
8381
&efi_config_table,
8482
&efi.esrt,
85-
&prop_phys,
8683
&efi_mem_attr_table,
8784
#ifdef CONFIG_EFI_RCI2_TABLE
8885
&rci2_table_phys,
@@ -502,22 +499,6 @@ void __init efi_init(void)
502499
return;
503500
}
504501

505-
/* Parse the EFI Properties table if it exists */
506-
if (prop_phys != EFI_INVALID_TABLE_ADDR) {
507-
efi_properties_table_t *tbl;
508-
509-
tbl = early_memremap_ro(prop_phys, sizeof(*tbl));
510-
if (tbl == NULL) {
511-
pr_err("Could not map Properties table!\n");
512-
} else {
513-
if (tbl->memory_protection_attribute &
514-
EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA)
515-
set_bit(EFI_NX_PE_DATA, &efi.flags);
516-
517-
early_memunmap(tbl, sizeof(*tbl));
518-
}
519-
}
520-
521502
set_bit(EFI_RUNTIME_SERVICES, &efi.flags);
522503
efi_clean_memmap();
523504

arch/x86/platform/efi/efi_64.c

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -412,51 +412,9 @@ static int __init efi_update_mem_attr(struct mm_struct *mm, efi_memory_desc_t *m
412412

413413
void __init efi_runtime_update_mappings(void)
414414
{
415-
efi_memory_desc_t *md;
416-
417-
/*
418-
* Use the EFI Memory Attribute Table for mapping permissions if it
419-
* exists, since it is intended to supersede EFI_PROPERTIES_TABLE.
420-
*/
421415
if (efi_enabled(EFI_MEM_ATTR)) {
422416
efi_disable_ibt_for_runtime = false;
423417
efi_memattr_apply_permissions(NULL, efi_update_mem_attr);
424-
return;
425-
}
426-
427-
/*
428-
* EFI_MEMORY_ATTRIBUTES_TABLE is intended to replace
429-
* EFI_PROPERTIES_TABLE. So, use EFI_PROPERTIES_TABLE to update
430-
* permissions only if EFI_MEMORY_ATTRIBUTES_TABLE is not
431-
* published by the firmware. Even if we find a buggy implementation of
432-
* EFI_MEMORY_ATTRIBUTES_TABLE, don't fall back to
433-
* EFI_PROPERTIES_TABLE, because of the same reason.
434-
*/
435-
436-
if (!efi_enabled(EFI_NX_PE_DATA))
437-
return;
438-
439-
for_each_efi_memory_desc(md) {
440-
unsigned long pf = 0;
441-
442-
if (!(md->attribute & EFI_MEMORY_RUNTIME))
443-
continue;
444-
445-
if (!(md->attribute & EFI_MEMORY_WB))
446-
pf |= _PAGE_PCD;
447-
448-
if ((md->attribute & EFI_MEMORY_XP) ||
449-
(md->type == EFI_RUNTIME_SERVICES_DATA))
450-
pf |= _PAGE_NX;
451-
452-
if (!(md->attribute & EFI_MEMORY_RO) &&
453-
(md->type != EFI_RUNTIME_SERVICES_CODE))
454-
pf |= _PAGE_RW;
455-
456-
if (cc_platform_has(CC_ATTR_GUEST_MEM_ENCRYPT))
457-
pf |= _PAGE_ENC;
458-
459-
efi_update_mappings(md, pf);
460418
}
461419
}
462420

include/linux/efi.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -379,7 +379,6 @@ void efi_native_runtime_setup(void);
379379
#define EFI_SYSTEM_RESOURCE_TABLE_GUID EFI_GUID(0xb122a263, 0x3661, 0x4f68, 0x99, 0x29, 0x78, 0xf8, 0xb0, 0xd6, 0x21, 0x80)
380380
#define EFI_FILE_SYSTEM_GUID EFI_GUID(0x964e5b22, 0x6459, 0x11d2, 0x8e, 0x39, 0x00, 0xa0, 0xc9, 0x69, 0x72, 0x3b)
381381
#define DEVICE_TREE_GUID EFI_GUID(0xb1b621d5, 0xf19c, 0x41a5, 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0)
382-
#define EFI_PROPERTIES_TABLE_GUID EFI_GUID(0x880aaca3, 0x4adc, 0x4a04, 0x90, 0x79, 0xb7, 0x47, 0x34, 0x08, 0x25, 0xe5)
383382
#define EFI_RNG_PROTOCOL_GUID EFI_GUID(0x3152bca5, 0xeade, 0x433d, 0x86, 0x2e, 0xc0, 0x1c, 0xdc, 0x29, 0x1f, 0x44)
384383
#define EFI_RNG_ALGORITHM_RAW EFI_GUID(0xe43176d7, 0xb6e8, 0x4827, 0xb7, 0x84, 0x7f, 0xfd, 0xc4, 0xb6, 0x85, 0x61)
385384
#define EFI_MEMORY_ATTRIBUTES_TABLE_GUID EFI_GUID(0xdcfa911d, 0x26eb, 0x469f, 0xa2, 0x20, 0x38, 0xb7, 0xdc, 0x46, 0x12, 0x20)
@@ -580,15 +579,6 @@ struct efi_mem_range {
580579
u64 attribute;
581580
};
582581

583-
typedef struct {
584-
u32 version;
585-
u32 length;
586-
u64 memory_protection_attribute;
587-
} efi_properties_table_t;
588-
589-
#define EFI_PROPERTIES_TABLE_VERSION 0x00010000
590-
#define EFI_PROPERTIES_RUNTIME_MEMORY_PROTECTION_NON_EXECUTABLE_PE_DATA 0x1
591-
592582
typedef struct {
593583
u16 version;
594584
u16 length;
@@ -871,10 +861,9 @@ static inline int efi_range_is_wc(unsigned long start, unsigned long len)
871861
#define EFI_PARAVIRT 6 /* Access is via a paravirt interface */
872862
#define EFI_ARCH_1 7 /* First arch-specific bit */
873863
#define EFI_DBG 8 /* Print additional debug info at runtime */
874-
#define EFI_NX_PE_DATA 9 /* Can runtime data regions be mapped non-executable? */
875-
#define EFI_MEM_ATTR 10 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
876-
#define EFI_MEM_NO_SOFT_RESERVE 11 /* Is the kernel configured to ignore soft reservations? */
877-
#define EFI_PRESERVE_BS_REGIONS 12 /* Are EFI boot-services memory segments available? */
864+
#define EFI_MEM_ATTR 9 /* Did firmware publish an EFI_MEMORY_ATTRIBUTES table? */
865+
#define EFI_MEM_NO_SOFT_RESERVE 10 /* Is the kernel configured to ignore soft reservations? */
866+
#define EFI_PRESERVE_BS_REGIONS 11 /* Are EFI boot-services memory segments available? */
878867

879868
#ifdef CONFIG_EFI
880869
/*

0 commit comments

Comments
 (0)