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]
Date:   Sun, 24 May 2020 01:05:28 +0530
From:   Souptick Joarder <jrdr.linux@...il.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Paul Mackerras <paulus@...abs.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>, acme@...nel.org,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        namhyung@...nel.org, pbonzini@...hat.com,
        Stephen Rothwell <sfr@...b.auug.org.au>,
        Mike Rapoport <rppt@...ux.ibm.com>, msuchanek@...e.de,
        "Aneesh Kumar K.V" <aneesh.kumar@...ux.ibm.com>,
        kvm-ppc@...r.kernel.org, linuxppc-dev@...ts.ozlabs.org,
        linux-kernel@...r.kernel.org, Linux-MM <linux-mm@...ck.org>,
        kvm@...r.kernel.org, John Hubbard <jhubbard@...dia.com>
Subject: Re: [linux-next RFC] mm/gup.c: Convert to use get_user_pages_fast_only()

On Sat, May 23, 2020 at 10:55 PM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Sat, May 23, 2020 at 10:11:12PM +0530, Souptick Joarder wrote:
> > Renaming the API __get_user_pages_fast() to get_user_pages_
> > fast_only() to align with pin_user_pages_fast_only().
>
> Please don't split a function name across lines.  That messes
> up people who are grepping for the function name in the changelog.

Ok.

>
> > As part of this we will get rid of write parameter.
> > Instead caller will pass FOLL_WRITE to get_user_pages_fast_only().
> > This will not change any existing functionality of the API.
> >
> > All the callers are changed to pass FOLL_WRITE.
> >
> > Updated the documentation of the API.
>
> Everything you have done here is an improvement, and I'd be happy to
> see it go in (after fixing the bug I note below).
>
> But in reading through it, I noticed almost every user ...
>
> > -     if (__get_user_pages_fast(hva, 1, 1, &page) == 1) {
> > +     if (get_user_pages_fast_only(hva, 1, FOLL_WRITE, &page) == 1) {
>
> passes '1' as the second parameter.  So do we want to add:
>
> static inline bool get_user_page_fast_only(unsigned long addr,
>                 unsigned int gup_flags, struct page **pagep)
> {
>         return get_user_pages_fast_only(addr, 1, gup_flags, pagep) == 1;
> }
>
Yes, this can be added. Does get_user_page_fast_only() naming is fine ?


> > @@ -2797,10 +2803,7 @@ int __get_user_pages_fast(unsigned long start, int nr_pages, int write,
> >        * FOLL_FAST_ONLY is required in order to match the API description of
> >        * this routine: no fall back to regular ("slow") GUP.
> >        */
> > -     unsigned int gup_flags = FOLL_GET | FOLL_FAST_ONLY;
> > -
> > -     if (write)
> > -             gup_flags |= FOLL_WRITE;
> > +     gup_flags = FOLL_GET | FOLL_FAST_ONLY;
>
> Er ... gup_flags |=, surely?

Poor mistake.


@@ -1998,7 +1998,7 @@ int gfn_to_page_many_atomic(struct
kvm_memory_slot *slot, gfn_t gfn,
        if (entry < nr_pages)
                return 0;

-       return __get_user_pages_fast(addr, nr_pages, 1, pages);
+       return get_user_pages_fast(addr, nr_pages, FOLL_WRITE, pages);

Also this needs to be corrected.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ