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: <20201126104720.GO3306@suse.de>
Date:   Thu, 26 Nov 2020 10:47:20 +0000
From:   Mel Gorman <mgorman@...e.de>
To:     Andrea Arcangeli <aarcange@...hat.com>
Cc:     Vlastimil Babka <vbabka@...e.cz>,
        Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
        Qian Cai <cai@....pw>, Michal Hocko <mhocko@...nel.org>,
        David Hildenbrand <david@...hat.com>,
        linux-kernel@...r.kernel.org, Mike Rapoport <rppt@...ux.ibm.com>,
        Baoquan He <bhe@...hat.com>
Subject: Re: [PATCH 1/1] mm: compaction: avoid fast_isolate_around() to set
 pageblock_skip on reserved pages

On Wed, Nov 25, 2020 at 12:59:58PM -0500, Andrea Arcangeli wrote:
> On Wed, Nov 25, 2020 at 10:30:53AM +0000, Mel Gorman wrote:
> > On Tue, Nov 24, 2020 at 03:56:22PM -0500, Andrea Arcangeli wrote:
> > > Hello,
> > > 
> > > On Tue, Nov 24, 2020 at 01:32:05PM +0000, Mel Gorman wrote:
> > > > I would hope that is not the case because they are not meant to overlap.
> > > > However, if the beginning of the pageblock was not the start of a zone
> > > > then the pages would be valid but the pfn would still be outside the
> > > > zone boundary. If it was reserved, the struct page is valid but not
> > > > suitable for set_pfnblock_flags_mask. However, it is a concern in
> > > > general because the potential is there that pages are isolated from the
> > > > wrong zone.
> > > 
> > > I guess we have more than one issue to correct in that function
> > > because the same BUG_ON reproduced again even with the tentative patch
> > > I posted earlier.
> > > 
> > > So my guess is that the problematic reserved page isn't pointed by the
> > > min_pfn, but it must have been pointed by the "highest" variable
> > > calculated below?
> > > 
> > > 			if (pfn >= highest)
> > > 				highest = pageblock_start_pfn(pfn);
> > > 
> > > When I looked at where "highest" comes from, it lacks
> > > pageblock_pfn_to_page check (which was added around v5.7 to min_pfn).
> > > 
> > > Is that the real bug, which may be fixed by something like this? (untested)
> > > 
> > 
> > It's plausible as it is a potential source of leaking but as you note
> > in another mail, it's surprising to me that valid struct pages, even if
> > within memory holes and reserved would have broken node/zone information
> > in the page flags.
> 
> I think the patch to add pageblock_pfn_to_page is still needed to cope
> with !pfn_valid or a pageblock in between zones, but pfn_valid or
> pageblock in between zones is not what happens here.
> 
> So the patch adding pageblock_pfn_to_page would have had the undesired
> side effect of hiding the bug so it's best to deal with the other bug
> first.
> 

Agreed. This thread has a lot of different directions in it at this
point so what I'd hope for is first, a patch that initialises holes with
zone/node linkages within a 1<<(MAX_ORDER-1) alignment. If there is a
hole, it would be expected the pages are PageReserved. Second, a fix to
fast_isolate that forces PFNs returned to always be within the stated
zone boundaries.

The first is because there are assumptions that without HOLES_IN_ZONE, a
true pfn_valid within 1<<(MAX_ORDER-1) means pfn_valid would be true for
any PFN within that range. That assumption is relaxed in many cases --
e.g. the page allocator may not care at the moment because of how it
orders checks but compaction assumes that pfn_valid within a pageblock
means that all PFNs within that pageblock are valid.

-- 
Mel Gorman
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ