Re: [PATCH V2] mm: Recheck page table entry with page table lock held
From: Kirill A. Shutemov
Date: Wed Sep 26 2018 - 08:40:39 EST
On Wed, Sep 26, 2018 at 08:48:58AM +0530, Aneesh Kumar K.V wrote:
> We clear the pte temporarily during read/modify/write update of the pte. If we
> take a page fault while the pte is cleared, the application can get SIGBUS. One
> such case is with remap_pfn_range without a backing vm_ops->fault callback.
> do_fault will return SIGBUS in that case.
>
> cpu 0 cpu1
> mprotect()
> ptep_modify_prot_start()/pte cleared.
> .
> . page fault.
> .
> .
> prep_modify_prot_commit()
>
> Fix this by taking page table lock and rechecking for pte_none.
>
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxx>
> ---
> V1:
> * update commit message.
You choosed to stick with VM_FAULT_NOPAGE, that's fine.
Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
Should it be in stable?
--
Kirill A. Shutemov