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]
Message-ID: <CAHk-=wiP8fB7R70h5MqDUFu2=nVHytsrdDKmQHmQTeYbyhifrA@mail.gmail.com>
Date:   Thu, 4 Feb 2021 09:54:37 -0800
From:   Linus Torvalds <torvalds@...ux-foundation.org>
To:     Peter Xu <peterx@...hat.com>
Cc:     Linux-MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Kirill Shutemov <kirill@...temov.name>,
        Wei Zhang <wzam@...zon.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>,
        Matthew Wilcox <willy@...radead.org>,
        Miaohe Lin <linmiaohe@...wei.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Gal Pressman <galpress@...zon.com>, Jan Kara <jack@...e.cz>,
        Jann Horn <jannh@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Kirill Tkhai <ktkhai@...tuozzo.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Jason Gunthorpe <jgg@...pe.ca>,
        David Gibson <david@...son.dropbear.id.au>,
        Christoph Hellwig <hch@....de>
Subject: Re: [PATCH v2 3/4] mm: Introduce page_needs_cow_for_dma() for
 deciding whether cow

On Thu, Feb 4, 2021 at 6:50 AM Peter Xu <peterx@...hat.com> wrote:
>
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -1291,6 +1291,27 @@ static inline bool page_maybe_dma_pinned(struct page *page)
>                 GUP_PIN_COUNTING_BIAS;
>  }
>
> +static inline bool is_cow_mapping(vm_flags_t flags)
> +{
> +       return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
> +}

Oh, and I just realized: moving this to <linux/mm.h> means that this
patch could/should also get rid of

 - manual copy of this in mm/hugetlb.c:

        cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;

 - private #define for the same thing in fs/proc/task_mmu.c

    #define is_cow_mapping(flags) (((flags) & (VM_SHARED |
VM_MAYWRITE)) == VM_MAYWRITE)

 - manual copy in drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c:

        bool is_cow_mapping =
                (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;

I guess it could be a later cleanup patch too, but maybe best done in
this series just to not forget about it.

               Linus

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ