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-next>] [day] [month] [year] [list]
Date:   Tue, 2 Feb 2021 16:40:33 +0200
From:   Gal Pressman <galpress@...zon.com>
To:     Peter Xu <peterx@...hat.com>, Jason Gunthorpe <jgg@...pe.ca>
CC:     Linus Torvalds <torvalds@...ux-foundation.org>,
        John Hubbard <jhubbard@...dia.com>,
        Leon Romanovsky <leonro@...dia.com>,
        Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        "Maya B . Gokhale" <gokhale2@...l.gov>,
        Yang Shi <yang.shi@...ux.alibaba.com>,
        Marty Mcfadden <mcfadden8@...l.gov>,
        Kirill Shutemov <kirill@...temov.name>,
        Oleg Nesterov <oleg@...hat.com>, Jann Horn <jannh@...gle.com>,
        Jan Kara <jack@...e.cz>, Kirill Tkhai <ktkhai@...tuozzo.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Christoph Hellwig <hch@....de>,
        Andrew Morton <akpm@...ux-foundation.org>,
        "Zhang, Wei" <wzam@...zon.com>
Subject: Re: [PATCH 1/4] mm: Trial do_wp_page() simplification

> On Thu, Sep 17, 2020 at 03:03:32PM -0400, Peter Xu wrote:
> 
>> Another side effect I can think of is that we'll bring some uncertainty to
>> fork() starting from when page_maybe_dma_pinned() is used, since it's sometimes
>> bogus (hpage_pincount_available()==false) so some COWs might be triggered
>> during fork() even when not necessary if we've got some normal pages with too
>> many refcounts (over GUP_PIN_COUNTING_BIAS).  But assuming that's not a big
>> deal since it should be extremely rare, or is it?..
> 
> Looking at this a bit more.. A complete implementation will have to
> touch all four places doing write protect during fork:
> 
> copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm,
> 		pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma,
> 		unsigned long addr, int *rss)
> {
> [..]
> 	if (is_cow_mapping(vm_flags) && pte_write(pte)) {
> 		ptep_set_wrprotect(src_mm, addr, src_pte);
> 		pte = pte_wrprotect(pte);
> 
> int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,
> 		  pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,
> 		  struct vm_area_struct *vma)
> {
> [..]
> 	pmdp_set_wrprotect(src_mm, addr, src_pmd);
> 	pmd = pmd_mkold(pmd_wrprotect(pmd));
> 
> int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm,
> 		  pud_t *dst_pud, pud_t *src_pud, unsigned long addr,
> 		  struct vm_area_struct *vma)
> {
> [..]
> 	pudp_set_wrprotect(src_mm, addr, src_pud);
> 	pud = pud_mkold(pud_wrprotect(pud));
> 
> int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
>                             struct vm_area_struct *vma)
> {
> [..]
>                         if (cow) {
>                                 huge_ptep_set_wrprotect(src, addr, src_pte);
> 
> As a regression I'm pretty sure we will hit only the PTE and PMD
> cases.
> 
> Most likely the other two could be done outside the rc cycle

Hi Peter & Jason,

It seems the hugetlb part was overlooked?
We're testing if the RDMA fork MADV_DONTFORK stuff can be removed on appropriate
kernels, but our tests still fail due to lacking explicit huge pages support [1].

Peter, was it left unchanged on purpose?
Are you planning to submit the hugetlb changes as well?

[1] https://github.com/linux-rdma/rdma-core/pull/883#issuecomment-770398171

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ