From: Andrew Morton <akpm@linux-foundation.org>
To: Michal Hocko <mhocko@suse.com>
Cc: Charan Teja Kalla <quic_charante@quicinc.com>,
david@redhat.com, vbabka@suse.cz, pasha.tatashin@soleen.com,
shakeelb@google.com, sieberf@amazon.com, sjpark@amazon.de,
william.kucharski@oracle.com, willy@infradead.org,
quic_pkondeti@quicinc.com, minchan@google.com,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH V5] mm: fix use-after free of page_ext after race with memory-offline
Date: Fri, 26 Aug 2022 20:12:42 -0700 [thread overview]
Message-ID: <20220826201242.bbf4948e5221c883dadfc2d6@linux-foundation.org> (raw)
In-Reply-To: <Ywh5BHIpMpTjy3B6@dhcp22.suse.cz>
On Fri, 26 Aug 2022 09:40:52 +0200 Michal Hocko <mhocko@suse.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();
_
next prev parent reply other threads:[~2022-08-27 3:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-26 6:56 Charan Teja Kalla
2022-08-26 7:40 ` Michal Hocko
2022-08-27 3:12 ` Andrew Morton [this message]
2022-08-26 7:52 ` David Hildenbrand
2022-08-27 3:19 ` Andrew Morton
2022-08-29 10:44 ` Charan Teja Kalla
2022-11-07 15:41 ` Vlastimil Babka
2022-11-08 5:21 ` Charan Teja Kalla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220826201242.bbf4948e5221c883dadfc2d6@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=minchan@google.com \
--cc=pasha.tatashin@soleen.com \
--cc=quic_charante@quicinc.com \
--cc=quic_pkondeti@quicinc.com \
--cc=shakeelb@google.com \
--cc=sieberf@amazon.com \
--cc=sjpark@amazon.de \
--cc=vbabka@suse.cz \
--cc=william.kucharski@oracle.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox