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]
Date:   Tue, 11 Apr 2023 15:13:18 -0400
From:   Peter Xu <peterx@...hat.com>
To:     Mike Rapoport <rppt@...ux.ibm.com>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Andrea Arcangeli <aarcange@...hat.com>,
        David Hildenbrand <david@...hat.com>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Nadav Amit <nadav.amit@...il.com>,
        Mike Kravetz <mike.kravetz@...cle.com>,
        Axel Rasmussen <axelrasmussen@...gle.com>,
        Leonardo Bras Soares Passos <lsoaresp@...hat.com>,
        Mike Rapoport <rppt@...ux.vnet.ibm.com>
Subject: Re: [PATCH 14/29] selftests/mm: uffd_[un]register()

On Fri, Apr 07, 2023 at 02:08:54PM +0300, Mike Rapoport wrote:
> > @@ -96,11 +95,7 @@ static void register_region_with_uffd(char *addr, size_t len)
> >  	 * handling by the userfaultfd object. In mode, we request to track
> >  	 * missing pages (i.e., pages that have not yet been faulted in).
> >  	 */
> > -
> > -	uffdio_register.range.start = (unsigned long)addr;
> > -	uffdio_register.range.len = len;
> > -	uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
> > -	if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1) {
> > +	if (uffd_register(uffd, addr, len, true, false, false)) {
> 
> I'd replace booleans with a bit flags as it easier to read.
> Other than that LGTM.

It was mostly for no need to remember the long names of macros, and easier
when conditionally set with some modes. E.g., we have 5 callers have things
like:

  uffd_register(..., test_uffdio_wp ? UFFDIO_REGISTER_MODE_WP : 0);

The bools simplifes it to:

  uffd_register(..., test_uffdio_wp, ...);

But let me know if you still think that's better - I can switch here.

Thanks,

-- 
Peter Xu

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ