mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
UPSTREAM: arm64: mm: pass original fault address to handle_mm_fault() in PER_VMA_LOCK block
When reading the arm64's PER_VMA_LOCK support code, I found a bit difference between arm64 and other arch when calling handle_mm_fault() during VMA lock-based page fault handling: the fault address is masked before passing to handle_mm_fault(). This is also different from the usage in mmap_lock-based handling. I think we need to pass the original fault address to handle_mm_fault() as we did in commit84c5e23ede("arm64: mm: Pass original fault address to handle_mm_fault()"). If we go through the code path further, we can find that the "masked" fault address can cause mismatched fault address between perf sw major/minor page fault sw event and perf page fault sw event: do_page_fault perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, ..., addr) // orig addr handle_mm_fault mm_account_fault perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, ...) // masked addr Bug: 254441685 Fixes:cd7f176aea("arm64/mm: try VMA lock-based page fault handling first") Signed-off-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Suren Baghdasaryan <surenb@google.com> Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com> Acked-by: Catalin Marinas <catalin.marinas@arm.com> Link: https://lore.kernel.org/r/20230524131305.2808-1-jszhang@kernel.org Signed-off-by: Will Deacon <will@kernel.org> (cherry picked from commit0e2aba6948) Signed-off-by: Lee Jones <joneslee@google.com> Change-Id: Ie7622f6f7c0e9af5436361de85626e0465cef685
This commit is contained in:
committed by
Treehugger Robot
parent
39385f7568
commit
dd451f19f0
@@ -626,8 +626,7 @@ static int __kprobes do_page_fault(unsigned long far, unsigned long esr,
|
|||||||
vma_end_read(vma);
|
vma_end_read(vma);
|
||||||
goto lock_mmap;
|
goto lock_mmap;
|
||||||
}
|
}
|
||||||
fault = handle_mm_fault(vma, addr & PAGE_MASK,
|
fault = handle_mm_fault(vma, addr, mm_flags | FAULT_FLAG_VMA_LOCK, regs);
|
||||||
mm_flags | FAULT_FLAG_VMA_LOCK, regs);
|
|
||||||
vma_end_read(vma);
|
vma_end_read(vma);
|
||||||
|
|
||||||
if (!(fault & VM_FAULT_RETRY)) {
|
if (!(fault & VM_FAULT_RETRY)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user