diff options
author | Borislav Petkov <bp@suse.de> | 2014-02-14 02:24:24 -0500 |
---|---|---|
committer | Matt Fleming <matt.fleming@intel.com> | 2014-02-14 04:30:19 -0500 |
commit | c55d016f7a930dd1c995336017123b469a8c8f5a (patch) | |
tree | 428d313b67fe1cf2fc9e3c9e1ecc8e989726059f | |
parent | b28a960c42fcd9cfc987441fa6d1c1a471f0f9ed (diff) |
x86/efi: Fix 32-bit fallout
We do not enable the new efi memmap on 32-bit and thus we need to run
runtime_code_page_mkexec() unconditionally there. Fix that.
Reported-and-tested-by: Lejun Zhu <lejun.zhu@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Signed-off-by: Matt Fleming <matt.fleming@intel.com>
-rw-r--r-- | arch/x86/include/asm/efi.h | 2 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi.c | 5 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi_32.c | 6 | ||||
-rw-r--r-- | arch/x86/platform/efi/efi_64.c | 9 |
4 files changed, 19 insertions, 3 deletions
diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h index 3b978c472d08..3d6b9f81cc68 100644 --- a/arch/x86/include/asm/efi.h +++ b/arch/x86/include/asm/efi.h | |||
@@ -132,6 +132,8 @@ extern void __init efi_map_region_fixed(efi_memory_desc_t *md); | |||
132 | extern void efi_sync_low_kernel_mappings(void); | 132 | extern void efi_sync_low_kernel_mappings(void); |
133 | extern void efi_setup_page_tables(void); | 133 | extern void efi_setup_page_tables(void); |
134 | extern void __init old_map_region(efi_memory_desc_t *md); | 134 | extern void __init old_map_region(efi_memory_desc_t *md); |
135 | extern void __init runtime_code_page_mkexec(void); | ||
136 | extern void __init efi_runtime_mkexec(void); | ||
135 | 137 | ||
136 | struct efi_setup_data { | 138 | struct efi_setup_data { |
137 | u64 fw_vendor; | 139 | u64 fw_vendor; |
diff --git a/arch/x86/platform/efi/efi.c b/arch/x86/platform/efi/efi.c index d62ec87a2b26..1a201ac7cef8 100644 --- a/arch/x86/platform/efi/efi.c +++ b/arch/x86/platform/efi/efi.c | |||
@@ -792,7 +792,7 @@ void __init efi_set_executable(efi_memory_desc_t *md, bool executable) | |||
792 | set_memory_nx(addr, npages); | 792 | set_memory_nx(addr, npages); |
793 | } | 793 | } |
794 | 794 | ||
795 | static void __init runtime_code_page_mkexec(void) | 795 | void __init runtime_code_page_mkexec(void) |
796 | { | 796 | { |
797 | efi_memory_desc_t *md; | 797 | efi_memory_desc_t *md; |
798 | void *p; | 798 | void *p; |
@@ -1069,8 +1069,7 @@ void __init efi_enter_virtual_mode(void) | |||
1069 | efi.update_capsule = virt_efi_update_capsule; | 1069 | efi.update_capsule = virt_efi_update_capsule; |
1070 | efi.query_capsule_caps = virt_efi_query_capsule_caps; | 1070 | efi.query_capsule_caps = virt_efi_query_capsule_caps; |
1071 | 1071 | ||
1072 | if (efi_enabled(EFI_OLD_MEMMAP) && (__supported_pte_mask & _PAGE_NX)) | 1072 | efi_runtime_mkexec(); |
1073 | runtime_code_page_mkexec(); | ||
1074 | 1073 | ||
1075 | kfree(new_memmap); | 1074 | kfree(new_memmap); |
1076 | 1075 | ||
diff --git a/arch/x86/platform/efi/efi_32.c b/arch/x86/platform/efi/efi_32.c index 249b183cf417..0b74cdf7f816 100644 --- a/arch/x86/platform/efi/efi_32.c +++ b/arch/x86/platform/efi/efi_32.c | |||
@@ -77,3 +77,9 @@ void efi_call_phys_epilog(void) | |||
77 | 77 | ||
78 | local_irq_restore(efi_rt_eflags); | 78 | local_irq_restore(efi_rt_eflags); |
79 | } | 79 | } |
80 | |||
81 | void __init efi_runtime_mkexec(void) | ||
82 | { | ||
83 | if (__supported_pte_mask & _PAGE_NX) | ||
84 | runtime_code_page_mkexec(); | ||
85 | } | ||
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c index 6284f158a47d..0c2a234fef1e 100644 --- a/arch/x86/platform/efi/efi_64.c +++ b/arch/x86/platform/efi/efi_64.c | |||
@@ -233,3 +233,12 @@ void __init parse_efi_setup(u64 phys_addr, u32 data_len) | |||
233 | { | 233 | { |
234 | efi_setup = phys_addr + sizeof(struct setup_data); | 234 | efi_setup = phys_addr + sizeof(struct setup_data); |
235 | } | 235 | } |
236 | |||
237 | void __init efi_runtime_mkexec(void) | ||
238 | { | ||
239 | if (!efi_enabled(EFI_OLD_MEMMAP)) | ||
240 | return; | ||
241 | |||
242 | if (__supported_pte_mask & _PAGE_NX) | ||
243 | runtime_code_page_mkexec(); | ||
244 | } | ||