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: <7b19b521-01cf-fafb-e616-21deced2cd5b@nvidia.com>
Date:   Thu, 10 Feb 2022 11:20:31 -0800
From:   John Hubbard <jhubbard@...dia.com>
To:     Minchan Kim <minchan@...nel.org>
Cc:     linux-mm <linux-mm@...ck.org>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: pin_user_pages supports NULL pages arguments?

On 2/10/22 11:17, Minchan Kim wrote:
>   * pin_user_pages() - pin user pages in memory for use by other devices
>   < snip >
>   * @pages:      array that receives pointers to the pages pinned.
>   *              Should be at least nr_pages long. Or NULL, if caller
>   *              only intends to ensure the pages are faulted in.
> 
> pin_user_pages(,, pages = NULL, );
>    gup_flags |= FOLL_PIN
>    __get_user_pages_locked
>      __get_user_pages
>        ..
>        VM_BUG_ON(!!pages != !!(gup_flags & (FOLL_GET | FOLL_PIN)));

Only FOLL_GET or FOLL_PIN are supposed to fill in the **pages array. So
if a caller passes a null **pages arg, then that caller must not also
set FOLL_GET or FOLL_PIN. That's what the VM_BUG_ON() is expressing.

Perhaps that should be part of the documentation. It sort of is already,
for get_user_pages*().

thanks,
-- 
John Hubbard
NVIDIA

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ