[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220826201242.bbf4948e5221c883dadfc2d6@linux-foundation.org>
Date: Fri, 26 Aug 2022 20:12:42 -0700
From: Andrew Morton <akpm@...ux-foundation.org>
To: Michal Hocko <mhocko@...e.com>
Cc: Charan Teja Kalla <quic_charante@...cinc.com>, david@...hat.com,
vbabka@...e.cz, pasha.tatashin@...een.com, shakeelb@...gle.com,
sieberf@...zon.com, sjpark@...zon.de, william.kucharski@...cle.com,
willy@...radead.org, quic_pkondeti@...cinc.com, minchan@...gle.com,
linux-kernel@...r.kernel.org, linux-mm@...ck.org
Subject: Re: [PATCH V5] mm: fix use-after free of page_ext after race with
memory-offline
On Fri, 26 Aug 2022 09:40:52 +0200 Michal Hocko <mhocko@...e.com> wrote:
> > Changes in V5:
> > o Used the loop variable name as ext_put_continue -- David
>
> If this is the only change since the last version (I didn't have much
> time to read through the whole patch) then my ack still applies.
yup.
--- a/mm/page_owner.c~mm-fix-use-after-free-of-page_ext-after-race-with-memory-offline-v5
+++ a/mm/page_owner.c
@@ -326,7 +326,7 @@ void pagetypeinfo_showmixedcount_print(s
continue;
if (!test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags))
- goto loop;
+ goto ext_put_continue;
page_owner = get_page_owner(page_ext);
page_mt = gfp_migratetype(page_owner->gfp_mask);
@@ -341,7 +341,7 @@ void pagetypeinfo_showmixedcount_print(s
break;
}
pfn += (1UL << page_owner->order) - 1;
-loop:
+ext_put_continue:
page_ext_put(page_ext);
}
}
@@ -561,14 +561,14 @@ read_page_owner(struct file *file, char
* because we don't hold the zone lock.
*/
if (!test_bit(PAGE_EXT_OWNER, &page_ext->flags))
- goto loop;
+ goto ext_put_continue;
/*
* Although we do have the info about past allocation of free
* pages, it's not relevant for current memory usage.
*/
if (!test_bit(PAGE_EXT_OWNER_ALLOCATED, &page_ext->flags))
- goto loop;
+ goto ext_put_continue;
page_owner = get_page_owner(page_ext);
@@ -577,7 +577,7 @@ read_page_owner(struct file *file, char
* would inflate the stats.
*/
if (!IS_ALIGNED(pfn, 1 << page_owner->order))
- goto loop;
+ goto ext_put_continue;
/*
* Access to page_ext->handle isn't synchronous so we should
@@ -585,7 +585,7 @@ read_page_owner(struct file *file, char
*/
handle = READ_ONCE(page_owner->handle);
if (!handle)
- goto loop;
+ goto ext_put_continue;
/* Record the next PFN to read in the file offset */
*ppos = (pfn - min_low_pfn) + 1;
@@ -594,7 +594,7 @@ read_page_owner(struct file *file, char
page_ext_put(page_ext);
return print_page_owner(buf, count, pfn, page,
&page_owner_tmp, handle);
-loop:
+ext_put_continue:
page_ext_put(page_ext);
}
@@ -654,13 +654,13 @@ static void init_pages_in_zone(pg_data_t
/* Maybe overlapping zone */
if (test_bit(PAGE_EXT_OWNER, &page_ext->flags))
- goto loop;
+ goto ext_put_continue;
/* Found early allocated page */
__set_page_owner_handle(page_ext, early_handle,
0, 0);
count++;
-loop:
+ext_put_continue:
page_ext_put(page_ext);
}
cond_resched();
_
Powered by blists - more mailing lists