From: Luiz Capitulino <lcapitulino@redhat.com>
To: Chao Fan <fanc.fnst@cn.fujitsu.com>
Cc: Baoquan He <bhe@redhat.com>, <linux-kernel@vger.kernel.org>,
<x86@kernel.org>, <hpa@zytor.com>, <tglx@linutronix.de>,
<mingo@redhat.com>, <keescook@chromium.org>,
<yasu.isimatu@gmail.com>, <indou.takao@jp.fujitsu.com>,
<caoj.fnst@cn.fujitsu.com>, <douly.fnst@cn.fujitsu.com>
Subject: Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory
Date: Mon, 8 Jan 2018 09:39:54 -0500 [thread overview]
Message-ID: <20180108093954.51dccabf@redhat.com> (raw)
In-Reply-To: <20180105025810.GA7714@localhost.localdomain>
On Fri, 5 Jan 2018 10:58:11 +0800
Chao Fan <fanc.fnst@cn.fujitsu.com> wrote:
> On Thu, Jan 04, 2018 at 06:30:57PM +0800, Baoquan He wrote:
> >On 01/04/18 at 04:02pm, Chao Fan wrote:
> >> In current code, kaslr may choose the memory region in movable
> >> nodes to extract kernel, which will make the nodes can't be hot-removed.
> >> To solve it, we can specify the memory region in immovable node.
> >> Create immovable_mem to store the regions in immovable_mem, where should
> >> be chosen by kaslr.
> >>
> >> Also change the "handle_mem_memmap" to "handle_mem_filter", since
> >> it will not only handle memmap parameter now.
> >> Since "immovable_mem=" only works with "movable_node", so "immovable_mem="
> >> doesn't work alone. If specify "movable_node" without "immovable_mem=",
> >> disable KASLR.
> >>
> >> Multiple regions can be specified, comma delimited.
> >> Considering the usage of memory, only support for 4 regions.
> >> 4 regions contains 2 nodes at least, enough for kernel to extract.
> >>
> >> Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com>
> >
> >Hi Chao,
> >
> >Thanks for your effort on this issue.
> >
> >Luiz told me they met a hugetlb issue when kaslr enabled on kvm guest.
> >Please check the below bug information. There's only one available
> >position which hugepage can use to allocate. In this case, if we have a
> >generic parameter to tell kernel where we can randomize into, this
> >hugepage issue can be solved. We can restrict kernel to randomize beyond
> >[0x40000000, 0x7fffffff]. Not sure if your immovable_mem=nn[KMG]@ss[KMG]
> >can be adjusted to do this. I am hesitating on whether we should change
> >this or not.
> >
>
> Hi Baoquan, Luiz,
>
> In my personal understanding, there is only one region,
> [0x40000000, 0x7fffffff] suitable for the 1G page, so we should avoid
> kaslr to choose this region, right?
For a guest configured with 4GB of memory with the device configuration
we're using yes.
> If my understanding is right, I think it's more similar with mem_avoid.
> Because we specify where KASLR *choose* in "immovable_mem=", we specify
> where KASLR *avoid* in "mem_avoid".
> So I wonder if it's OK to expand mem_avoid, and add a member like
> MEM_AVOID_HUGEPAGE in "enum mem_avoid_index".
> But there is a disadvantage, we can only specify the limited regions.
Not requiring new command-line options would be great for users,
but I'm not sure it's possible to use mem_avoid because I guess the
free area may vary depending on amount of memory, devices, etc.
> Luiz, I am not familiar with HUGE PAGE, I wonder how many 1G HUGE pages
> does system need in general? We may need to limit it in 2, or 4.
I don't think it's possible to impose a limit. But the case we've
been discussing in this thread it the case that has the greater
impact: a guest with 4GB of memory which always has 1GB page with nokaslr,
but may not have any 1GB page without nokaslr.
next prev parent reply other threads:[~2018-01-08 14:39 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-04 8:02 [PATCH v5 0/4] kaslr: add parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr Chao Fan
2018-01-04 8:02 ` [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory Chao Fan
2018-01-04 10:30 ` Baoquan He
2018-01-04 16:21 ` KASLR may break some kernel features (was Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory) Luiz Capitulino
2018-01-11 9:00 ` Baoquan He
2018-01-11 18:04 ` Kees Cook
2018-01-12 2:00 ` Chao Fan
2018-01-12 2:31 ` Baoquan He
2018-01-12 2:47 ` Chao Fan
2018-01-12 18:52 ` Luiz Capitulino
2018-01-13 4:02 ` Baoquan He
2018-01-13 5:06 ` Chao Fan
2018-01-31 2:18 ` Baoquan He
2018-01-05 2:58 ` [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory Chao Fan
2018-01-08 14:39 ` Luiz Capitulino [this message]
2018-01-09 1:36 ` Chao Fan
2018-01-04 8:02 ` [PATCH v5 2/4] kaslr: calculate the memory region in immovable node Chao Fan
2018-01-04 8:02 ` [PATCH v5 3/4] kaslr: disable memory mirror feature when movable_node Chao Fan
2018-01-04 8:02 ` [PATCH v5 4/4] document: change the document for immovable_mem Chao Fan
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=20180108093954.51dccabf@redhat.com \
--to=lcapitulino@redhat.com \
--cc=bhe@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=douly.fnst@cn.fujitsu.com \
--cc=fanc.fnst@cn.fujitsu.com \
--cc=hpa@zytor.com \
--cc=indou.takao@jp.fujitsu.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=tglx@linutronix.de \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox