From fedc4d513e7794ef7cb288f89879de98a9e4686d Mon Sep 17 00:00:00 2001 From: Michel Lespinasse Date: Mon, 24 Jan 2022 17:43:55 -0800 Subject: [PATCH] FROMLIST: mm: implement speculative handling in do_numa_page() change do_numa_page() to use pte_spinlock() when locking the page table, so that the mmap sequence counter will be validated in the speculative case. Signed-off-by: Michel Lespinasse Link: https://lore.kernel.org/all/20220128131006.67712-21-michel@lespinasse.org/ Bug: 161210518 Signed-off-by: Suren Baghdasaryan Change-Id: If252547faf2a8a6cbba4c0a7ff929071a5f6a657 --- mm/memory.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index fc961c2fa5cf..7d27c277c97b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4443,8 +4443,8 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) * validation through pte_unmap_same(). It's of NUMA type but * the pfn may be screwed if the read is non atomic. */ - vmf->ptl = pte_lockptr(vma->vm_mm, vmf->pmd); - spin_lock(vmf->ptl); + if (!pte_spinlock(vmf)) + return VM_FAULT_RETRY; if (unlikely(!pte_same(*vmf->pte, vmf->orig_pte))) { pte_unmap_unlock(vmf->pte, vmf->ptl); goto out;