Starting with c6f3c5ee40c1 ("mm/huge_memory.c: fix modifying of page protection by insert_pfn_pmd()") vmf_insert_pfn_pmd() internally calls pmdp_set_access_flags(). That helper enforces a pmd aligned @address argument via VM_BUG_ON() assertion. Update the implementation to take a 'struct vm_fault' argument directly and apply the address alignment fixup internally to fix crash signatures like: kernel BUG at arch/x86/mm/pgtable.c:515! invalid opcode: 0000 [#1] SMP NOPTI CPU: 51 PID: 43713 Comm: java Tainted: G OE 4.19.35 #1 [..] RIP: 0010:pmdp_set_access_flags+0x48/0x50 [..] Call Trace: vmf_insert_pfn_pmd+0x198/0x350 dax_iomap_fault+0xe82/0x1190 ext4_dax_huge_fault+0x103/0x1f0 ? __switch_to_asm+0x40/0x70 __handle_mm_fault+0x3f6/0x1370 ? __switch_to_asm+0x34/0x70 ? __switch_to_asm+0x40/0x70 handle_mm_fault+0xda/0x200 __do_page_fault+0x249/0x4f0 do_page_fault+0x32/0x110 ? page_fault+0x8/0x30 page_fault+0x1e/0x30
Showing the changes to include/linux (1 of 4 files). Show all
Unified · Split
| @@ -47,10 +47,8 @@ extern bool move_huge_pmd(struct vm_area_struct *vma, unsigned long old_addr, · 46 unmodified lines | ||
| 47 | 47 | extern int change_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, |
| 48 | 48 | unsigned long addr, pgprot_t newprot, |
| 49 | 49 | int prot_numa); |
| 50 | −vm_fault_t vmf_insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, | |
| 51 | − pmd_t *pmd, pfn_t pfn, bool write); | |
| 52 | −vm_fault_t vmf_insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, | |
| 53 | − pud_t *pud, pfn_t pfn, bool write); | |
| 50 | +vm_fault_t vmf_insert_pfn_pmd(struct vm_fault *vmf, pfn_t pfn, bool write); | |
| 51 | +vm_fault_t vmf_insert_pfn_pud(struct vm_fault *vmf, pfn_t pfn, bool write); | |
| 54 | 52 | enum transparent_hugepage_flag { |
| 55 | 53 | TRANSPARENT_HUGEPAGE_FLAG, |
| 56 | 54 | TRANSPARENT_HUGEPAGE_REQ_MADV_FLAG, |