[PATCH v8 0/5] x86/KASLR: Add parameter kaslr_mem=nn[KMG]@ss[KMG]

2018-01-23 Thread Chao Fan
27;s suggestion: - Change names of several functions. - Add a new parameter "immovable_mem" instead of extending mvoable_node - Use the clamp to calculate the memory intersecting, which makes logical more clear. - Disable memory mirror if movable_node specified v1->v2: Follow Dou Liyan

Re: [PATCH v8 5/5] document: add document for kaslr_mem

2018-01-18 Thread Chao Fan
On Fri, Jan 19, 2018 at 11:53:31AM +0800, Baoquan He wrote: >On 01/19/18 at 11:36am, Chao Fan wrote: >> Signed-off-by: Chao Fan >> --- >> Documentation/admin-guide/kernel-parameters.txt | 10 ++ >> 1 file changed, 10 insertions(+) >> >> diff -

[RESEND PATCH v8 5/5] document: add document for kaslr_mem

2018-01-18 Thread Chao Fan
Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet Cc: Randy Dunlap Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel

[PATCH v8 5/5] document: add document for kaslr_mem

2018-01-18 Thread Chao Fan
Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index e2de7c006a74..28a879f62560 100644 --- a

[PATCH v8 4/5] x86/KASLR: Skip memory mirror handling if movable_node specified

2018-01-18 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in KASLR. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot

[PATCH v8 3/5] x86/KASLR: Give a warning if movable_node specified without kaslr_mem=

2018-01-18 Thread Chao Fan
Since only 'movable_node' specified without 'kaslr_mem=' may break memory hotplug, so reconmmend users using 'kaslr_mem=' when 'movable_node' specified. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 10 ++ 1 file changed, 10 i

Re: [PATCH v7 3/5] x86/KASLR: Give a warning if movable_node specified without kaslr_mem=

2018-01-17 Thread Chao Fan
On Wed, Jan 17, 2018 at 10:02:48PM +0800, Baoquan He wrote: >On 01/17/18 at 06:53pm, Chao Fan wrote: >> Since only 'movable_node' specified without 'kaslr_mem=' may break >> memory hotplug, so reconmmend users using 'kaslr_mem=' when >> '

Re: [PATCH v7 4/5] x86/KASLR: Skip memory mirror handling if movable_node specified

2018-01-17 Thread Chao Fan
On Wed, Jan 17, 2018 at 10:03:54PM +0800, Baoquan He wrote: >On 01/17/18 at 06:53pm, Chao Fan wrote: >> In kernel code, if movable_node specified, it will skip the mirror >> feature. So we should also skip mirror feature in KASLR. >> >> Signed-off-by: Chao Fan >>

Re: [PATCH v7 0/5] x86/KASLR: Add parameter kaslr_mem=nn[KMG]@ss[KMG]

2018-01-17 Thread Chao Fan
On Wed, Jan 17, 2018 at 12:32:35PM -0500, Luiz Capitulino wrote: >On Wed, 17 Jan 2018 18:53:46 +0800 >Chao Fan wrote: > >> ***Background: >> People reported that kaslr may randomly chooses some positions >> which are located in movable memory regions. This will brea

[PATCH v7 3/5] x86/KASLR: Give a warning if movable_node specified without kaslr_mem=

2018-01-17 Thread Chao Fan
Since only 'movable_node' specified without 'kaslr_mem=' may break memory hotplug, so reconmmend users using 'kaslr_mem=' when 'movable_node' specified.. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 10 ++ 1 file changed, 10 i

[PATCH v7 4/5] x86/KASLR: Skip memory mirror handling if movable_node specified

2018-01-17 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in KASLR. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot

[PATCH v7 0/5] x86/KASLR: Add parameter kaslr_mem=nn[KMG]@ss[KMG]

2018-01-17 Thread Chao Fan
ting, which makes logical more clear. - Disable memory mirror if movable_node specified v1->v2: Follow Dou Liyang's suggestion: - Add the parse for movable_node=nn[KMG] without @ss[KMG] - Fix the bug for more than one "movable_node=" specified - Drop useless variables

[PATCH v7 2/5] x86/KASLR: Handle the memory regions specified in kaslr_mem

2018-01-17 Thread Chao Fan
gion. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 64 +--- 1 file changed, 53 insertions(+), 11 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index b21741135673..b200a7ceafc1 100644 --- a/arch

[PATCH v7 5/5] document: add document for kaslr_mem

2018-01-17 Thread Chao Fan
Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index e2de7c006a74..f6d5adde1a73 100644 --- a

[PATCH v7 1/5] x86/KASLR: Add kaslr_mem=nn[KMG]@ss[KMG]

2018-01-17 Thread Chao Fan
regions, this will make memory hotplug fail. With the help of 'kaslr_mem=', limit kernel in those immovable regions specified. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 73 ++-- 1 file changed, 70 insertions(+), 3 deletions(-) di

Re: [PATCH v6 5/5] kaslr: add kaslr_mem=nn[KMG]!ss[KMG] to avoid memory regions

2018-01-16 Thread Chao Fan
On Tue, Jan 16, 2018 at 11:34:23AM -0500, Luiz Capitulino wrote: >On Tue, 16 Jan 2018 08:43:20 +0800 >Baoquan He wrote: > >> On 01/15/18 at 08:49pm, Chao Fan wrote: >> > Hi Luiz, >> > >> > I don't know if this patch is OK for you. >> > O

Re: [PATCH v6 5/5] kaslr: add kaslr_mem=nn[KMG]!ss[KMG] to avoid memory regions

2018-01-15 Thread Chao Fan
On Tue, Jan 16, 2018 at 08:43:20AM +0800, Baoquan He wrote: >On 01/15/18 at 08:49pm, Chao Fan wrote: >> Hi Luiz, >> >> I don't know if this patch is OK for you. >> Of coure you can only use kaslr_mem=nn@ss to solve the 1G huge page >> issue. Because we know

Re: [PATCH v6 1/5] kaslr: add kaslr_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-15 Thread Chao Fan
On Mon, Jan 15, 2018 at 02:40:35PM -0800, Randy Dunlap wrote: >On 01/15/2018 04:40 AM, Chao Fan wrote: >> In current code, kaslr only has a method to avoid some memory regions, >> but no method to specify the regions for kaslr to extract. So kaslr >> may choose the wrong posi

[PATCH v6 0/5] kaslr: add parameter kaslr_mem=nn[KMG][@|!ss[KMG]]

2018-01-15 Thread Chao Fan
ption for the document. v4->v5: - Change the problem reported by LKP Follow Dou's suggestion: - Also return if match "movable_node" when parsing kernel commandline in handle_mem_filter without define CONFIG_MEMORY_HOTPLUG v5->v6: - Add the last patch to save the avoid m

[PATCH v6 3/5] kaslr: disable memory mirror feature when movable_node

2018-01-15 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot

[PATCH v6 1/5] kaslr: add kaslr_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-15 Thread Chao Fan
t;handle_mem_filter", since it will not only handle memmap parameter now. 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 --- ar

[PATCH v6 5/5] kaslr: add kaslr_mem=nn[KMG]!ss[KMG] to avoid memory regions

2018-01-15 Thread Chao Fan
period. It can help users to avoid more memory regions, not only the 1G huge huge page issue. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 56 +++- 1 file changed, 50 insertions(+), 6 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b

Re: [PATCH v6 1/5] kaslr: add kaslr_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-15 Thread Chao Fan
On Mon, Jan 15, 2018 at 08:40:12PM +0800, Chao Fan wrote: >In current code, kaslr only has a method to avoid some memory regions, >but no method to specify the regions for kaslr to extract. So kaslr >may choose the wrong position sometimes, which will cause some other >features fail.

Re: [PATCH v6 5/5] kaslr: add kaslr_mem=nn[KMG]!ss[KMG] to avoid memory regions

2018-01-15 Thread Chao Fan
e too slow and is not good for the randomness. So as Kess said, I put the regions suitable for 1G huge page to mem_avoid, you can use kaslr_mem=1G!1G to solve the problem in your email. Thanks, Chao Fan On Mon, Jan 15, 2018 at 08:40:16PM +0800, Chao Fan wrote: >In current code, kaslr choose

[PATCH v6 4/5] kaslr: calculate the memory region in kaslr_mem

2018-01-15 Thread Chao Fan
If there is no kaslr_mem= region specified, use region directely. Otherwise, calculate the intersecting between efi or e820 memmap entry and kaslr_mem. Rename process_mem_region to slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan

[PATCH v6 2/5] kaslr: give a warning if movable_node specified without kaslr_mem=

2018-01-15 Thread Chao Fan
Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index b071f6edd7b2..38816d3f8865 100644 --- a/arch/x86/boot/compressed/kaslr.c +++ b/arch/x86/boot

Re: KASLR may break some kernel features (was Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory)

2018-01-12 Thread Chao Fan
On Sat, Jan 13, 2018 at 12:02:26PM +0800, Baoquan He wrote: >On 01/12/18 at 01:52pm, Luiz Capitulino wrote: >> On Fri, 12 Jan 2018 10:47:53 +0800 >> Chao Fan wrote: >> >> > On Fri, Jan 12, 2018 at 10:31:52AM +0800, Baoquan He wrote: >> > >On 01/11/18 at

Re: KASLR may break some kernel features (was Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory)

2018-01-11 Thread Chao Fan
;> >> Any ranges like that that need to be avoided should be known at build >> time, so they should simply be added to the mem_avoid list that is >> already present in the KASLR code... > >Seems KASLR doesn't have an solution which allow user to specify avoided >ran

Re: KASLR may break some kernel features (was Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory)

2018-01-11 Thread Chao Fan
s case, what range do we need to avoid? Only [1G, 2G]? > >Any ranges like that that need to be avoided should be known at build >time, so they should simply be added to the mem_avoid list that is >already present in the KASLR code... > Hi Kees, So this issue can be figured out in a independent patch. And does this patch have any problems? If so, please tell me, I will try my best to improve it. Thanks, Chao Fan >-Kees > >-- >Kees Cook >Pixel Security > >

Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-08 Thread Chao Fan
On Mon, Jan 08, 2018 at 09:39:54AM -0500, Luiz Capitulino wrote: >On Fri, 5 Jan 2018 10:58:11 +0800 >Chao Fan 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

Re: [PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-04 Thread Chao Fan
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 sp

[PATCH v5 4/4] document: change the document for immovable_mem

2018-01-04 Thread Chao Fan
Add the document for the change of new parameter immovable_mem=nn[KMG][@ss[KMG]]. Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin

[PATCH v5 3/4] kaslr: disable memory mirror feature when movable_node

2018-01-04 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot

[PATCH v5 2/4] kaslr: calculate the memory region in immovable node

2018-01-04 Thread Chao Fan
slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 67 +--- 1 file changed, 56 insertions(+), 11 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b

[PATCH v5 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2018-01-04 Thread Chao Fan
uot; 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 --- arch/x86/boot/compressed/kaslr.c | 1

[PATCH v5 0/4] kaslr: add parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr

2018-01-04 Thread Chao Fan
ovable_mem specified Follow Randy's suggestion: - Change the mistake and add detailed description for the document. v4->v5: - Change the problem reported by LKP Follow Dou's suggestion: - Also return if match "movable_node" when parsing kernel commandline in handle_mem_filte

Re: [RFC PATCH] memory-hotplug: add sysfs immovable_mem attribute

2018-01-01 Thread Chao Fan
specify the regions based on node. The memory region in a NUMA node just contain one or two acpi_srat_mem_affinity in acpi. But the memblock may have an intersection with two NUMA nodes. So the data in acpi table is exactly suitable for this issue. So I write the patch like this. Thanks, Chao

Re: [RFC PATCH] memory-hotplug: add sysfs immovable_mem attribute

2017-12-27 Thread Chao Fan
On Wed, Dec 27, 2017 at 01:47:26PM +0100, Greg KH wrote: >On Wed, Dec 27, 2017 at 08:30:12PM +0800, Chao Fan wrote: >> In sometimes users specify the memory region in immovable node in >> some kernel commandline, such as "kernel_core" or the "immovable_mem="

Re: [RFC PATCH] memory-hotplug: add sysfs immovable_mem attribute

2017-12-27 Thread Chao Fan
@13a00,1f40@15940 Any comments will be welcome. Thanks, Chao Fan On Wed, Dec 27, 2017 at 08:30:12PM +0800, Chao Fan wrote: >In sometimes users specify the memory region in immovable node in >some kernel commandline, such as "kernel_core" or the "immovable_mem=" &g

[RFC PATCH] memory-hotplug: add sysfs immovable_mem attribute

2017-12-27 Thread Chao Fan
s: "nn@ss,nn@ss,...". "nn" means the size of memory region, "ss" means the start position of this region. Signed-off-by: Chao Fan --- drivers/base/memory.c | 50 ++ 1 file changed, 50 insertions(+) diff --git a/drivers/b

[PATCH v4.1 2/4] kaslr: calculate the memory region in immovable node

2017-12-17 Thread Chao Fan
slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan --- v4->v4.1: - Move the define "int i" out of for() loop. --- arch/x86/boot/compressed/kaslr.c | 66 +--- 1 file changed, 55 inse

Re: [PATCH v4 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-12 Thread Chao Fan
On Tue, Dec 12, 2017 at 08:07:02PM +0800, 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

Re: [PATCH v4 2/4] kaslr: calculate the memory region in immovable node

2017-12-12 Thread Chao Fan
On Tue, Dec 12, 2017 at 08:07:03PM +0800, Chao Fan wrote: >kaslr: calculate the memory region in immovable node > >If there is no immovable memory region specified, use region directely. >There are several conditons: >1. CONFIG_MEMORY_HOTPLUG is not specified to y. >2. imm

Re: [PATCH v4 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-12 Thread Chao Fan
On Tue, Dec 12, 2017 at 08:07:02PM +0800, 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

[PATCH v4 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-12 Thread Chao Fan
uot; 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 --- arch/x86/boot/compressed/kaslr.c | 1

[PATCH v4 3/4] kaslr: disable memory mirror feature when movable_node

2017-12-12 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet Cc: Randy Dunlap Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 7 +++ 1 file changed, 7 insertions

[PATCH v4 4/4] document: change the document for immovable_mem

2017-12-12 Thread Chao Fan
Add the document for the change of new parameter immovable_mem=nn[KMG][@ss[KMG]]. Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 10 ++ 1 file changed, 10 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin

[PATCH v4 2/4] kaslr: calculate the memory region in immovable node

2017-12-12 Thread Chao Fan
and immovable memory. Rename process_mem_region to slots_count to match slots_fetch_random, and rename new function sa process_mem_region. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 65 +--- 1 file changed, 54 insertions(+), 11 deletions

[PATCH v4 0/4] aslr: add parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr

2017-12-12 Thread Chao Fan
_count" - Reanme the new function "process_immovable_mem" to "process_mem_region" Follow Baoquan's suggestion: - Fail KASLR if "movable_node" specified without "immovable_mem" - Ajust the code place of handling mem_region directely if no immovabl

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-06 Thread Chao Fan
On Thu, Dec 07, 2017 at 12:58:06PM +0800, Baoquan He wrote: >On 12/07/17 at 12:16pm, Dou Liyang wrote: >> Hi All, >> >> At 12/07/2017 11:56 AM, Chao Fan wrote: >> > On Thu, Dec 07, 2017 at 11:09:24AM +0800, Baoquan He wrote: >> > > On 12/07/17 at 10:53a

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-06 Thread Chao Fan
On Thu, Dec 07, 2017 at 11:09:24AM +0800, Baoquan He wrote: >On 12/07/17 at 10:53am, Chao Fan wrote: >> On Wed, Dec 06, 2017 at 05:35:57PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >Yes, now the code looks much better than the last version. >> &g

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-06 Thread Chao Fan
On Wed, Dec 06, 2017 at 05:35:57PM +0800, Baoquan He wrote: >Hi Chao, > >Yes, now the code looks much better than the last version. > >On 12/05/17 at 04:51pm, Chao Fan wrote: >> In current code, kaslr may choose the memory region in movable >> nodes to extract kernel

Re: [PATCH v3 2/4] kaslr: calculate the memory region in immovable node

2017-12-06 Thread Chao Fan
On Wed, Dec 06, 2017 at 04:11:04PM -0800, Kees Cook wrote: >On Wed, Dec 6, 2017 at 2:02 AM, Chao Fan wrote: >> On Wed, Dec 06, 2017 at 05:28:00PM +0800, Baoquan He wrote: >>>On 12/05/17 at 11:40am, Kees Cook wrote: >>>> On Tue, Dec 5, 2017 at 12:51 AM, Chao Fan

Re: [PATCH v3 2/4] kaslr: calculate the memory region in immovable node

2017-12-06 Thread Chao Fan
On Wed, Dec 06, 2017 at 05:28:00PM +0800, Baoquan He wrote: >On 12/05/17 at 11:40am, Kees Cook wrote: >> On Tue, Dec 5, 2017 at 12:51 AM, Chao Fan wrote: >> > If there is no immovable memory region specified, go on the old code. >> > There are several conditons: >&

Re: [PATCH v3 4/4] document: change the document for immovable_mem

2017-12-05 Thread Chao Fan
On Tue, Dec 05, 2017 at 09:36:24AM -0800, Randy Dunlap wrote: >On 12/05/2017 12:52 AM, Chao Fan wrote: >> Add the document for the change of new parameter >> immovable_mem=nn[KMG]@ss[KMG]. >> >> Cc: linux-...@vger.kernel.org >> Cc: Jonathan C

Re: [PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-05 Thread Chao Fan
On Tue, Dec 05, 2017 at 11:42:42AM -0800, Kees Cook wrote: >On Tue, Dec 5, 2017 at 12:51 AM, 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,

[PATCH v3 2/4] kaslr: calculate the memory region in immovable node

2017-12-05 Thread Chao Fan
If there is no immovable memory region specified, go on the old code. There are several conditons: 1. CONFIG_MEMORY_HOTPLUG is not specified to y. 2. immovable_mem= is not specified. Otherwise, calculate the intersecting between memmap entry and immovable memory. Signed-off-by: Chao Fan

[PATCH v3 3/4] kaslr: disable memory mirror feature when movable_node specified

2017-12-05 Thread Chao Fan
In kernel code, if movable_node specified, it will skip the mirror feature. So we should also skip mirror feature in kaslr. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/compressed

[PATCH v3 1/4] kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory

2017-12-05 Thread Chao Fan
ap parameter now. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 80 ++-- 1 file changed, 77 insertions(+), 3 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c index a63fbc25ce84..0bbbaf5f6370 1

[PATCH v3 4/4] document: change the document for immovable_mem

2017-12-05 Thread Chao Fan
Add the document for the change of new parameter immovable_mem=nn[KMG]@ss[KMG]. Cc: linux-...@vger.kernel.org Cc: Jonathan Corbet Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/admin-guide

[PATCH v3 0/4] kaslr: add new parameter immovable_mem=nn[KMG]@ss[KMG] to make memory hotplug work well with kaslr

2017-12-05 Thread Chao Fan
ng, which makes logical more clear. - Disable memory mirror if movable_node specified Chao Fan (4): kaslr: add immovable_mem=nn[KMG]@ss[KMG] to specify extracting memory kaslr: calculate the memory region in immovable node kaslr: disable memory mirror feature when movable_node specified document:

[tip:x86/urgent] x86/boot/KASLR: Remove unused variable

2017-11-23 Thread tip-bot for Chao Fan
Commit-ID: 69550d41ff9c884c6d996fca41037974b2255852 Gitweb: https://git.kernel.org/tip/69550d41ff9c884c6d996fca41037974b2255852 Author: Chao Fan AuthorDate: Thu, 23 Nov 2017 17:08:47 +0800 Committer: Thomas Gleixner CommitDate: Thu, 23 Nov 2017 20:17:59 +0100 x86/boot/KASLR: Remove

[PATCH] kaslr: clean up a useless variable and some usless space

2017-11-23 Thread Chao Fan
There are two same variable "rc" in mem_avoid_memmap. One is in the circulation, the other is out of the circulation. The one out will never be used, so drop it. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) di

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 05:26:24PM +0800, Baoquan He wrote: >On 11/13/17 at 05:18pm, Chao Fan wrote: >> On Mon, Nov 13, 2017 at 04:31:31PM +0800, Baoquan He wrote: >> >On 11/01/17 at 07:32pm, Chao Fan wrote: >> >> Compare the region of memmap entry and

Re: [PATCH v2 4/4] kaslr: clean up a useless variable and some usless space

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 04:32:33PM +0800, Baoquan He wrote: >On 11/01/17 at 07:32pm, Chao Fan wrote: >> There are two same variable "rc" in this function. One is in the >> circulation, the other is out of the circulation. The one out will never >> be used, so drop it

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 04:31:31PM +0800, Baoquan He wrote: >On 11/01/17 at 07:32pm, Chao Fan wrote: >> Compare the region of memmap entry and immovable_mem, then choose the >> intersection to process_mem_region. >> >> Since the interrelationship between e820 or efi e

Re: [PATCH v2 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-11-13 Thread Chao Fan
On Mon, Nov 13, 2017 at 04:10:41PM +0800, Baoquan He wrote: >Hi Chao, Hi Baoquan, Thanks for your reply. > >Please think more on your patches, better to discuss with your >colleagues and ask them to help review before your post. > >On 11/01/17 at 07:32pm, Chao Fan wr

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Fri, Nov 10, 2017 at 11:14:37AM +0800, Baoquan He wrote: >On 11/10/17 at 11:03am, Chao Fan wrote: >> On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >On 11/01/17 at 07:32pm, Chao Fan wrote: >> >> Compare the regio

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Fri, Nov 10, 2017 at 11:14:37AM +0800, Baoquan He wrote: >On 11/10/17 at 11:03am, Chao Fan wrote: >> On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >> >Hi Chao, >> > >> >On 11/01/17 at 07:32pm, Chao Fan wrote: >> >> Compare the regio

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >Hi Chao, > >On 11/01/17 at 07:32pm, Chao Fan wrote: >> Compare the region of memmap entry and immovable_mem, then choose the >> intersection to process_mem_region. >> >> Since the interrelationship betwe

Re: [PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-09 Thread Chao Fan
On Thu, Nov 09, 2017 at 04:21:32PM +0800, Baoquan He wrote: >Hi Chao, > >On 11/01/17 at 07:32pm, Chao Fan wrote: >> Compare the region of memmap entry and immovable_mem, then choose the >> intersection to process_mem_region. >> >> Since the interrelationship betwe

[PATCH v2 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-11-01 Thread Chao Fan
memmap. PATCH 3/4 add document. PATCH 4/4 cleans up some little problems. v1->v2: Follow Dou's suggestion: - Add the parse for movable_node=nn[KMG] without @ss[KMG] - Fix the bug for more than one "movable_node=" specified - Drop useless variables and use mem_vector region direct

[PATCH v2 3/4] document: change the document for the extended movable_node

2017-11-01 Thread Chao Fan
Add the document for the change of extended movable_node=nn[KMG]@ss[KMG]. Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/admin-guide/kernel

[PATCH v2 4/4] kaslr: clean up a useless variable and some usless space

2017-11-01 Thread Chao Fan
There are two same variable "rc" in this function. One is in the circulation, the other is out of the circulation. The one out will never be used, so drop it. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) di

[PATCH v2 2/4] kaslr: select the memory region in immovable node to process

2017-11-01 Thread Chao Fan
, and one entry of e820 or efi may contain the memory in different nodes sometimes. It may split one node or one entry to several regions. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 60 ++-- 1 file changed, 52 insertions(+), 8 deletions(-) diff

[PATCH v2 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-11-01 Thread Chao Fan
e the regions in immovable_mem, where should be chosen by 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 --- arch/x86/boot/compressed/ka

Re: [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-20 Thread Chao Fan
node, eg: > >"...movable_node=128G@128G movable_node=128G@256G..." > Yes, you are right. I thought users will specify the regions like this: movable_node=1G@2G,1G@4G If users want to use movable_node=1G@2G movable_node=1G@4G Your suggestion is helpful and I will update it. Thanks, Chao Fan >then, you will find the problem of you code. > >Thanks, > dou

Re: [PATCH 4/4] kaslr: clean up a useless variable and some usless space

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:19:48AM +0800, Dou Liyang wrote: >Hi Chao, > >At 10/19/2017 06:02 PM, Chao Fan wrote: >> There are two same variable "rc" in this function. One is in the >> circulation, the other is out of the circulation. The one out will never >> b

Re: [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
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

Re: [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:41:19AM +0800, Dou Liyang wrote: > > >At 10/20/2017 11:22 AM, Chao Fan wrote: >> On Fri, Oct 20, 2017 at 11:04:42AM +0800, Dou Liyang wrote: >> > Hi Chao, >> > >> Hi Dou-san, >> >> > At 10/19/2017 06:02 PM, Chao Fan

Re: [PATCH 2/4] kaslr: select the memory region in immovable node to process

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:17:26AM +0800, Dou Liyang wrote: >Hi Chao > Hi Dou-san, >At 10/19/2017 06:02 PM, Chao Fan wrote: >> Since the interrelationship between e820 or efi entries and memory >> region in immovable_mem is different: >> One memory region in one node

Re: [PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
On Fri, Oct 20, 2017 at 11:04:42AM +0800, Dou Liyang wrote: >Hi Chao, > Hi Dou-san, >At 10/19/2017 06:02 PM, Chao Fan wrote: >> Extend the movable_node to movable_node=nn[KMG]@ss[KMG]. >> Since in current code, kaslr may choose the memory region in hot-pluggable >> no

Re: [PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
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 som

[PATCH 2/4] kaslr: select the memory region in immovable node to process

2017-10-19 Thread Chao Fan
as a region to process_mem_region. It may split one node or one entry to several regions. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 72 1 file changed, 58 insertions(+), 14 deletions(-) diff --git a/arch/x86/boot/compressed/kaslr.c b

[PATCH 1/4] kaslr: parse the extended movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
usage of memory, only support for 4 regions. 4 regions contains 2 nodes at least, and is enough for kernel to extract. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 63 +++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/arch/x86

[PATCH 4/4] kaslr: clean up a useless variable and some usless space

2017-10-19 Thread Chao Fan
There are two same variable "rc" in this function. One is in the circulation, the other is out of the circulation. The one out will never be used, so drop it. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) di

[PATCH 0/4] kaslr: extend movable_node to movable_node=nn[KMG]@ss[KMG]

2017-10-19 Thread Chao Fan
tor, 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

[PATCH 3/4] document: change the document for the extended movable_node

2017-10-19 Thread Chao Fan
Add the document for the change of extended movable_node=nn[KMG]@ss[KMG]. Cc: Jonathan Corbet Cc: linux-...@vger.kernel.org Signed-off-by: Chao Fan --- Documentation/admin-guide/kernel-parameters.txt | 9 + 1 file changed, 9 insertions(+) diff --git a/Documentation/admin-guide/kernel

Re: [POC] Extend "movable_node" to "movable_node=nn@ss" and add the interface in /sys to show the value

2017-10-11 Thread Chao Fan
On Wed, Oct 11, 2017 at 04:42:15PM +0800, Baoquan He wrote: >Hi dear Fan San, Hi dear Uncle Bao, > >On 10/11/17 at 04:23pm, Chao Fan wrote: >> On Wed, Oct 11, 2017 at 03:55:13PM +0800, Baoquan He wrote: >> >Hi Fan San, >> >> 1. Get and parse the srat table be

Re: [POC] Extend "movable_node" to "movable_node=nn@ss" and add the interface in /sys to show the value

2017-10-11 Thread Chao Fan
On Wed, Oct 11, 2017 at 03:55:13PM +0800, Baoquan He wrote: >Hi Fan San, > >On 10/11/17 at 10:28am, Chao Fan wrote: >> Hi all, >> >> Here is a problem: >> Here is a machine with several NUMA nodes and some of them are hot-pluggable, >> It's not good for

[POC] Extend "movable_node" to "movable_node=nn@ss" and add the interface in /sys to show the value

2017-10-10 Thread Chao Fan
When srat table is parsed in acpi_parse_memory_affinity, fill the value and user can get and use them. If anyone has a better method, please let me know. Any comments will be welcome. Thanks, Chao Fan

Re: [PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-04 Thread Chao Fan
, including the memory location and length. But I have no idea that if it's elegant leaving it for users to fill the parameter. BTW, it may be like this: "movable_node=xxx@start,xxx@start,..." And I was also wondering if anyone has a better solution. Thanks, Chao Fan > >Thank

Re: [PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-03 Thread Chao Fan
On Mon, Sep 04, 2017 at 10:26:19AM +0800, Baoquan He wrote: >On 09/04/17 at 12:55am, Rafael J. Wysocki wrote: >> On Sunday, September 3, 2017 4:31:23 PM CEST Chao Fan wrote: >> > KASLR should choose the memory region of immovable node to extract kernel. >> > So get AC

Re: [PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-03 Thread Chao Fan
On Mon, Sep 04, 2017 at 12:55:00AM +0200, Rafael J. Wysocki wrote: >On Sunday, September 3, 2017 4:31:23 PM CEST Chao Fan wrote: >> KASLR should choose the memory region of immovable node to extract kernel. >> So get ACPI SRAT table and store the memory region of movable node which

[PATCH v2] kaslr: get ACPI SRAT table to avoid movable memory

2017-09-03 Thread Chao Fan
KASLR should choose the memory region of immovable node to extract kernel. So get ACPI SRAT table and store the memory region of movable node which kaslr shold avoid. Signed-off-by: Chao Fan --- v2: Add the support for bios --- arch/x86/boot/compressed/kaslr.c | 346

Re: [PATCH] actbl1.h: use tab instead of seven spaces as the indentation

2017-08-22 Thread Chao Fan
On Wed, Aug 23, 2017 at 03:43:33AM +, Zheng, Lv wrote: >Hi, > >> From: linux-acpi-ow...@vger.kernel.org >> [mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Chao Fan >> Subject: [PATCH] actbl1.h: use tab instead of seven spaces as the indentation >> >>

[PATCH] actbl1.h: use tab instead of seven spaces as the indentation

2017-08-22 Thread Chao Fan
The indentation of these two lines is seven spaces, but not tab. So fix it. Signed-off-by: Chao Fan --- include/acpi/actbl1.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/acpi/actbl1.h b/include/acpi/actbl1.h index b4ce55c008b0..d13e5b416a7e 100644 --- a

Re: [RFC PATCH] kaslr: get ACPI SRAT table to avoid movable memory

2017-08-18 Thread Chao Fan
a better method to handle the movable memory, please tell me. Thanks, Chao Fan On Fri, Aug 18, 2017 at 04:58:20PM +0800, Chao Fan wrote: >KASLR should choose the memory region of immovable node to extract kernel. >So get ACPI SRAT table and store the memory region of movable node which

[RFC PATCH] kaslr: get ACPI SRAT table to avoid movable memory

2017-08-18 Thread Chao Fan
KASLR should choose the memory region of immovable node to extract kernel. So get ACPI SRAT table and store the memory region of movable node which kaslr shold avoid. Signed-off-by: Chao Fan --- arch/x86/boot/compressed/kaslr.c | 231 +++ arch/x86/boot

Re: [PATCH v8 0/2] x86/boot/KASLR: Restrict kernel to be randomized in mirror regions

2017-08-04 Thread Chao Fan
ally weird. And Chao also is helping >to try on his side. Hi Bao, After testing for 10 times, no problem happened. Maybe you did something wrong in the first time. Thanks, Chao Fan > >> >> On 08/04/17 at 03:26pm, Baoquan He wrote: >> > Patch 1/2 is newly added to add

<    1   2   3   4   >