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: <ZIogXmFNr3MnBtjX@casper.infradead.org>
Date:   Wed, 14 Jun 2023 21:17:34 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Andrew Morton <akpm@...ux-foundation.org>
Cc:     "Vishal Moola (Oracle)" <vishal.moola@...il.com>,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/5] mmzone: Introduce folio_migratetype()

On Wed, Jun 14, 2023 at 01:13:05PM -0700, Andrew Morton wrote:
> On Tue, 13 Jun 2023 19:13:09 -0700 "Vishal Moola (Oracle)" <vishal.moola@...il.com> wrote:
> 
> > Introduce folio_migratetype() as a folio equivalent for
> > get_pageblock_migratetype(). This function intends to return the
> > migratetype the folio is located in, hence the name choice.
> > 
> > ...
> >
> > --- a/include/linux/mmzone.h
> > +++ b/include/linux/mmzone.h
> > @@ -105,6 +105,9 @@ extern int page_group_by_mobility_disabled;
> >  #define get_pageblock_migratetype(page)					\
> >  	get_pfnblock_flags_mask(page, page_to_pfn(page), MIGRATETYPE_MASK)
> >  
> > +#define folio_migratetype(folio)				\
> > +	get_pfnblock_flags_mask(&folio->page, folio_pfn(folio),		\
> > +			MIGRATETYPE_MASK)
> 
> Theoretically this is risky because it evaluates its argument more than
> once.  Although folio_migratetype(folio++) seems an unlikely thing to do.

folio++ is always an unsafe thing to do.  folios are not consecutive
in memory (unless we know they're order-0).

> An inlined C function is always preferable.  My quick attempt at that
> reveals that the header files are All Messed Up As Usual.

The page-equivalent of this also evaluates its arguments more than once,
so it doesn't see too risky for now?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ