From: Chao Fan <fanc.fnst@cn.fujitsu.com>
To: Dou Liyang <douly.fnst@cn.fujitsu.com>
Cc: <linux-kernel@vger.kernel.org>, <x86@kernel.org>, <hpa@zytor.com>,
<tglx@linutronix.de>, <mingo@redhat.com>, <bhe@redhat.com>,
<keescook@chromium.org>, <indou.takao@jp.fujitsu.com>,
<caoj.fnst@cn.fujitsu.com>
Subject: Re: [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]
Date: Fri, 20 Oct 2017 11:46:15 +0800 [thread overview]
Message-ID: <20171020034614.GD5635@localhost.localdomain> (raw)
In-Reply-To: <0399dc49-6293-cc4e-cbff-e267efca7407@cn.fujitsu.com>
On Fri, Oct 20, 2017 at 11:37:11AM +0800, Dou Liyang wrote:
>Hi Chao,
>
>At 10/20/2017 10:53 AM, Chao Fan wrote:
>> On Fri, Oct 20, 2017 at 10:37:52AM +0800, Dou Liyang wrote:
>> > Hi Chao,
>> >
>> Hi Dou-san,
>>
>> > Cheer! I have some concerns below.
>>
>> Thanks for your reply.
>>
>> >
>> > At 10/19/2017 06:02 PM, Chao Fan wrote:
>> > > Here is a problem:
>> > > Here is a machine with several NUMA nodes and some of them are hot-pluggable.
>> > > It's not good for kernel to be extracted in the memory region of movable node.
>> > > But in current code, I print the address choosen by kaslr and found it may be
>> > > placed in movable node sometimes. To solve this problem, it's better to limit
>> > > the memory region choosen by kaslr to immovable node in kaslr.c. But the memory
>> > > infomation about if it's hot-pluggable is stored in ACPI SRAT table, which is
>> > > parsed after kernel is extracted. So we can't get the detail memory infomation
>> > > before extracting kernel.
>> > >
>> > > So extend the movable_node to movable_node=nn@ss, in which nn means
>> > > the size of memory in *immovable* node, and ss means the start position of
>> > > this memory region. Then limit kaslr choose memory in these regions.
>> >
>> > Yes, great. Here we should remember that the situation of
>> > 'movable_node=nn@ss' is rare, normal situation is 'movable_node=nn'.
>> >
>> > So, we should consider our code tendencies for normal situation. ;-)
>>
>> Yes, it's normal. But you can not make sure the special situation will
>> never happen,. If it happens, we can make sure codes work well, right?
>>
>> We can not make sure that the movable nodes are continuous, or even if
>> the movable nodes are continuous, we can not make sure the memory
>> address are continuous.
>>
>> It is easy to avoid the memory region in movable node.
>> But if we can handle more special situations, and at the same time,
>> make kernel more safe, why not?
>
>You misunderstand my opinions, I means that
>when we code, we need to know the problem clearly and which part of
>problem will often be executed.
>
>Make our code more suitable for the normal situation without affecting the
>function of the problem.
>Just like:
>
>likely() and unlikely()
Hi Dou-san,
Thanks for that. I think likely() is suitable for another place.
Thanks,
Chao Fan
>
>Here I guess you don't consider that. so I said that.
>
>>
>> >
>> > >
>> > > There are two policies:
>> > > 1. Specify the memory region in *movable* node to avoid:
>> > > Then we can use the existing mem_avoid to handle. But if the memory
>> > > one movable node was separated by memory hole or different movable nodes
>> > > are discontinuous, we don't know how many regions need to avoid.
>> >
>> > It is not a problem.
>> >
>> > As you said, we should provide an interface for users later, like that:
>> >
>> > # cat /sys/device/system/memory/movable_node
>> > nn@ss
>> >
>>
>> Both are OK. I think outputing the memory region in movable_node or
>> immovable_node are both reasonable. So the interface of both methods
>> will be useful. And after we decided which policy used in kaslr, then
>> add the interface of /sys.
>>
>
>Actually, I prefer the first one, are you ready to post the patches
>for the first policy?
>
>Thanks,
> dou.
>> Thanks,
>> Chao Fan
>>
>> >
>> > Thanks,
>> > dou.
>> > > OTOH, we must avoid all of the movable memory, otherwise, kaslr may
>> > > choose the wrong place.
>> > > 2. Specify the memory region in "immovable* node to select:
>> > > Only support 4 regions in this parameter. Then user can use two nodes
>> > > at least for kaslr to choose, it's enough for the kernel to extract.
>> > > At the same time, because we need only 4 new mem_vector, the usage
>> > > of memory here is not too big.
>> > >
>> > > PATCH 1/4 parse the extended movable_node=nn[KMG]@ss[KMG], then
>> > > store the memory regions.
>> > > PATCH 2/4 selects the memory region in immovable node when process
>> > > memmap.
>> > > PATCH 3/4 is the change of document.
>> > > PATCH 4/4 cleans up some little problems.
>> > >
>> > > Chao Fan (4):
>> > > kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]
>> > > kaslr: select the memory region in immovable node to process
>> > > document: change the document for the extended movable_node
>> > > kaslr: clean up a useless variable and some usless space
>> > >
>> > > Documentation/admin-guide/kernel-parameters.txt | 9 ++
>> > > arch/x86/boot/compressed/kaslr.c | 140 +++++++++++++++++++++---
>> > > 2 files changed, 131 insertions(+), 18 deletions(-)
>> > >
>>
next prev parent reply other threads:[~2017-10-20 3:46 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-19 10:02 [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG] Chao Fan
2017-10-19 10:02 ` [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG] Chao Fan
2017-10-20 3:04 ` Dou Liyang
2017-10-20 3:22 ` Chao Fan
2017-10-20 3:41 ` Dou Liyang
2017-10-20 3:44 ` Chao Fan
2017-10-20 5:33 ` Dou Liyang
2017-10-20 9:34 ` Chao Fan
2017-10-19 10:02 ` [PATCH 2/4] kaslr: select the memory region in immovable node to process Chao Fan
2017-10-20 3:17 ` Dou Liyang
2017-10-20 3:41 ` Chao Fan
2017-10-20 6:05 ` Dou Liyang
2017-10-19 10:02 ` [PATCH 3/4] document: change the document for the extended movable_node Chao Fan
2017-10-19 10:02 ` [PATCH 4/4] kaslr: clean up a useless variable and some usless space Chao Fan
2017-10-20 3:19 ` Dou Liyang
2017-10-20 4:10 ` Chao Fan
2017-10-20 2:37 ` [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG] Dou Liyang
2017-10-20 2:53 ` Chao Fan
2017-10-20 3:37 ` Dou Liyang
2017-10-20 3:46 ` Chao Fan [this message]
2017-10-20 6:41 ` Dou Liyang
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=20171020034614.GD5635@localhost.localdomain \
--to=fanc.fnst@cn.fujitsu.com \
--cc=bhe@redhat.com \
--cc=caoj.fnst@cn.fujitsu.com \
--cc=douly.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 \
/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