mm-pagewalk-fix-efi_pgt_dump-of-espfix-area.patch removed from -mm tree
The quilt patch titled
Subject: mm/pagewalk: fix EFI_PGT_DUMP of espfix area
has been removed from the -mm tree. Its filename was
mm-pagewalk-fix-efi_pgt_dump-of-espfix-area.patch
This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Hugh Dickins <[email protected]>
Subject: mm/pagewalk: fix EFI_PGT_DUMP of espfix area
Date: Sun, 23 Jul 2023 14:17:55 -0700 (PDT)
Booting x86_64 with CONFIG_EFI_PGT_DUMP=y shows messages of the form "mm/pgtable-generic.c:53: bad pmd (____ptrval____)(8000000100077061)".
EFI_PGT_DUMP dumps all of efi_mm, including the espfix area, which is set up with pmd entries which fit the pmd_bad() check: so 0d940a9b270b warns and clears those entries, which would ruin running Win16 binaries.
The failing pte_offset_map() stopped such a kernel from even booting, until a few commits later be872f83bf57 changed the pagewalk to tolerate
that: but it needs to be even more careful, to not spoil those entries.
I might have preferred to change init_espfix_ap() not to use "bad" pmd entries; or to leave them out of the efi_mm dump. But there is great value in staying away from there, and a pagewalk check of address against TASK_SIZE may protect from other such aberrations too.
---
mm/pagewalk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
mm/pagewalk.c renamed from mm/pagewalk.c~mm-pagewalk-fix-efi_pgt_dump-of-espfix-area +4 -1
@@ -48,8 +48,11 @@ static int walk_pte_range(pmd_t *pmd, unif (walk->no_vma) {/* * pte_offset_map() might apply user-specific validation. +* Indeed, on x86_64 the pmd entries set up by init_espfix_ap() +* fit its pmd_bad() check (_PAGE_NX set and _PAGE_RW clear), +* and CONFIG_EFI_PGT_DUMP efi_mm goes so far as to walk them. */ -if (walk->mm == &init_mm) +if (walk->mm == &init_mm || addr >=TASK_SIZE ) pte =pte_offset_kernel (pmd, addr);else pte =pte_offset_map (pmd, addr);
_
Patches currently in -mm which might be from [email protected] are
mm-userfaultfd-add-new-uffdio_poison-ioctl-fix.patch mm-pgtable-add-rcu_read_lock-and-rcu_read_unlocks.patch mm-pgtable-add-pae-safety-to-__pte_offset_map.patch arm-adjust_pte-use-pte_offset_map_nolock.patch powerpc-assert_pte_locked-use-pte_offset_map_nolock.patch powerpc-assert_pte_locked-use-pte_offset_map_nolock-fix.patch powerpc-add-pte_free_defer-for-pgtables-sharing-page.patch sparc-add-pte_free_defer-for-pte_t-pgtable_t.patch s390-add-pte_free_defer-for-pgtables-sharing-page.patch s390-add-pte_free_defer-for-pgtables-sharing-page-fix.patch mm-pgtable-add-pte_free_defer-for-pgtable-as-page.patch mm-khugepaged-retract_page_tables-without-mmap-or-vma-lock.patch mm-khugepaged-collapse_pte_mapped_thp-with-mmap_read_lock.patch mm-khugepaged-collapse_pte_mapped_thp-with-mmap_read_lock-fix.patch mm-khugepaged-delete-khugepaged_collapse_pte_mapped_thps.patch mm-khugepaged-delete-khugepaged_collapse_pte_mapped_thps-fix.patch mm-delete-mmap_write_trylock-and-vma_try_start_write.patch mm-pgtable-notes-on-pte_offset_map.patch