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] [day] [month] [year] [list]
Message-ID: <0e567e11-e735-d092-afac-b2a3106d3f9b@huawei.com>
Date:   Mon, 5 Jun 2023 19:15:08 +0800
From:   "zhangpeng (AS)" <zhangpeng362@...wei.com>
To:     Mike Kravetz <mike.kravetz@...cle.com>,
        Matthew Wilcox <willy@...radead.org>
CC:     <linux-mm@...ck.org>, <linux-kernel@...r.kernel.org>,
        <akpm@...ux-foundation.org>, <muchun.song@...ux.dev>,
        <sidhartha.kumar@...cle.com>, <vishal.moola@...il.com>,
        <wangkefeng.wang@...wei.com>, <sunnanyong@...wei.com>
Subject: Re: [PATCH 2/2] mm/hugetlb: Use a folio in hugetlb_wp()

On 2023/6/3 4:52, Mike Kravetz wrote:

> On 06/02/23 21:17, Matthew Wilcox wrote:
>> On Fri, Jun 02, 2023 at 09:54:08AM +0800, Peng Zhang wrote:
>>> From: ZhangPeng <zhangpeng362@...wei.com>
>>>
>>> We can replace nine implict calls to compound_head() with one by using
>>> old_folio. However, we still need to keep old_page because we need to
>>> know which page in the folio we are copying.
>> Do we?  It's my understanding (and I am far from an expert here ...)
>> that the 'pte_t *' we are passed *inside hugetlbfs* is not in fact a pte
>> pointer at all but actually a pmd or pud pointer.
> That may not be technically true in some arch specific cases such as
> arm64 with CONT_PTES and CONT_PMDS.
>
>>                                                     See how we do this:
>>
>>          pte_t pte = huge_ptep_get(ptep);
>>
>> and so the page we get back is always a head page, and we can go
>> directly to a folio.  ie this is different from the THP cases.
> However, it is true that ptep will always be associated with the head
> page.  This is because the associated virtual address is hugetlb page
> aligned.
>
> So, I agree with Matthew that there is no need to keep old_page.
> Note that if old_page was NOT the head page, then
>
> 	copy_user_huge_page(&new_folio->page, old_page, address, vma,
> 		pages_per_huge_page(h));
>
> would write beyond the end of range as it assumes old_page is head.

Agreed. I'll send a v2 soon. Thanks.

Best Regards,
Peng

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ