Skip to content

Commit c8502eb

Browse files
nivedita76ardbiesheuvel
authored andcommitted
efi/x86: Mark kernel rodata non-executable for mixed mode
When remapping the kernel rodata section RO in the EFI pagetables, the protection flags that were used for the text section are being reused, but the rodata section should not be marked executable. Cc: <[email protected]> Signed-off-by: Arvind Sankar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ard Biesheuvel <[email protected]>
1 parent 9123e3a commit c8502eb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

arch/x86/platform/efi/efi_64.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned num_pages)
259259
npages = (__end_rodata - __start_rodata) >> PAGE_SHIFT;
260260
rodata = __pa(__start_rodata);
261261
pfn = rodata >> PAGE_SHIFT;
262+
263+
pf = _PAGE_NX | _PAGE_ENC;
262264
if (kernel_map_pages_in_pgd(pgd, pfn, rodata, npages, pf)) {
263265
pr_err("Failed to map kernel rodata 1:1\n");
264266
return 1;

0 commit comments

Comments
 (0)