From: Baoquan He <bhe@redhat.com>
To: Chao Fan <fanc.fnst@cn.fujitsu.com>,
akpm@linux-foundation.org, linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, x86@kernel.org,
yasu.isimatu@gmail.com, keescook@chromium.org,
indou.takao@jp.fujitsu.com, caoj.fnst@cn.fujitsu.com,
douly.fnst@cn.fujitsu.com, mhocko@suse.com, vbabka@suse.cz,
mgorman@techsingularity.net
Subject: Re: Bug report about KASLR and ZONE_MOVABLE
Date: Wed, 11 Jul 2018 20:41:55 +0800 [thread overview]
Message-ID: <20180711124155.GH1969@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20180711104944.GG1969@MiWiFi-R3L-srv>
On 07/11/18 at 06:49pm, Baoquan He wrote:
> On 07/11/18 at 06:41pm, Baoquan He wrote:
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 1521100..fe346b4 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -6678,6 +6678,8 @@ static void __init find_zone_movable_pfns_for_nodes(void)
> > unsigned long size_pages;
> >
> > start_pfn = max(start_pfn, zone_movable_pfn[nid]);
> > + /* KASLR may put kernel after 'start_pfn', start after kernel */
> > + start_pfn = max(start_pfn, PAGE_ALIGN(_etext));
>
> Sorry, I used wrong function.
>
> Please try this one:
>
> From 005435407a331ecf2803e5ebfdc44b8f5f8f9748 Mon Sep 17 00:00:00 2001
> From: Baoquan He <bhe@redhat.com>
> Date: Wed, 11 Jul 2018 18:30:04 +0800
> Subject: [PATCH v2] mm, page_alloc: find movable zone after kernel text
>
> In find_zone_movable_pfns_for_nodes(), when try to find the starting
> PFN movable zone begins in each node, kernel text position is not
> considered. KASLR may put kernel after which movable zone begins.
>
> Fix it by finding movable zone after kernel text.
>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> ---
> mm/page_alloc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 1521100..17584cc 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -6678,6 +6678,8 @@ static void __init find_zone_movable_pfns_for_nodes(void)
> unsigned long size_pages;
>
> start_pfn = max(start_pfn, zone_movable_pfn[nid]);
> + /* KASLR may put kernel after 'start_pfn', start after kernel */
> + start_pfn = max(start_pfn, PFN_UP(_etext));
It's wrong again, NACK, have posted v3 in this thread.
> if (start_pfn >= end_pfn)
> continue;
>
> --
> 2.1.0
>
prev parent reply other threads:[~2018-07-11 12:42 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-11 9:42 Bug report about KASLR and ZONE_MOVABLE Chao Fan
2018-07-11 10:04 ` Chao Fan
2018-07-11 10:16 ` Chao Fan
2018-07-11 10:41 ` Baoquan He
2018-07-11 10:41 ` Baoquan He
2018-07-11 10:49 ` Baoquan He
2018-07-11 10:49 ` Baoquan He
2018-07-11 12:40 ` Baoquan He
2018-07-11 12:40 ` Baoquan He
2018-07-11 17:59 ` [PATCH v3] mm, page_alloc: find movable zone after kernel text kbuild test robot
2018-07-11 19:02 ` kbuild test robot
2018-07-12 1:19 ` Bug report about KASLR and ZONE_MOVABLE Chao Fan
2018-07-12 1:19 ` Chao Fan
2018-07-12 12:08 ` Baoquan He
2018-07-12 5:49 ` Dou Liyang
2018-07-12 5:49 ` Dou Liyang
2018-07-12 6:01 ` Chao Fan
2018-07-12 6:01 ` Chao Fan
2018-07-12 12:32 ` Michal Hocko
2018-07-12 23:52 ` Baoquan He
2018-07-12 23:52 ` Baoquan He
2018-07-13 1:44 ` Chao Fan
2018-07-13 1:44 ` Chao Fan
2018-07-16 11:38 ` Michal Hocko
2018-07-16 13:02 ` Baoquan He
2018-07-16 15:24 ` Michal Hocko
2018-07-17 1:51 ` Baoquan He
2018-07-17 8:22 ` Michal Hocko
2018-07-11 12:41 ` Baoquan He [this message]
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=20180711124155.GH1969@MiWiFi-R3L-srv \
--to=bhe@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=douly.fnst@cn.fujitsu.com \
--cc=fanc.fnst@cn.fujitsu.com \
--cc=indou.takao@jp.fujitsu.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=mhocko@suse.com \
--cc=vbabka@suse.cz \
--cc=x86@kernel.org \
--cc=yasu.isimatu@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.