lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 24 Nov 2023 10:04:00 +0800
From:   "zhangpeng (AS)" <zhangpeng362@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     "Huang, Ying" <ying.huang@...el.com>, <linux-mm@...ck.org>,
        <linux-kernel@...r.kernel.org>, <akpm@...ux-foundation.org>,
        <fengwei.yin@...el.com>, <aneesh.kumar@...ux.ibm.com>,
        <shy828301@...il.com>, <hughd@...gle.com>, <david@...hat.com>,
        <wangkefeng.wang@...wei.com>, <sunnanyong@...wei.com>
Subject: Re: [RFC PATCH] mm: filemap: avoid unnecessary major faults in
 filemap_fault()

On 2023/11/23 23:33, Matthew Wilcox wrote:

> On Thu, Nov 23, 2023 at 05:09:04PM +0800, zhangpeng (AS) wrote:
>>>> +		pte_t *ptep = pte_offset_map_lock(vmf->vma->vm_mm, vmf->pmd,
>>>> +						  vmf->address, &vmf->ptl);
>>>> +		if (ptep) {
>>>> +			/*
>>>> +			 * Recheck pte with ptl locked as the pte can be cleared
>>>> +			 * temporarily during a read/modify/write update.
>>>> +			 */
>>>> +			if (unlikely(!pte_none(ptep_get(ptep))))
>>>> +				ret = VM_FAULT_NOPAGE;
>>>> +			pte_unmap_unlock(ptep, vmf->ptl);
>>>> +			if (unlikely(ret))
>>>> +				return ret;
>>>> +		}
>>>> +
>>> Need to deal with ptep == NULL.  Although that is high impossible.
>> If ptep == NULL, we may just need to return VM_FAULT_SIGBUS.
>> I'll add it in the next version.
> no?  wouldn't ptep being NULL mean that the ptep has been replaced with
> a PMD entry, and thus should return NOPAGE?

Yes, ptep == NULL means that the ptep has been replaced with a PMD entry.
I'll add return NOPAGE in the next version.

Thanks!

-- 
Best Regards,
Peng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ