Introduce kstrtoull() from lib/kstrtox.c to boot directory so that code
in boot/ can use kstrtoull() and the old simple_strtoull() can be
replaced.
Signed-off-by: Chao Fan
---
arch/x86/boot/string.c | 137 +
arch/x86/boot/string.h | 2 +
2 files changed
CONFIG_EARLY_PARSE_RSDP is enabled, walk through SRAT to get the
information of immovable memory so that KASLR knows where should be
chosen for randomization.
Rename process_mem_region() as __process_mem_region() and name new
function as process_mem_region().
Signed-off-by: Chao Fan
---
arch/x86/boot
SRAT should be parsed by RSDP to fix the conflict between KASLR
and memory-hotremove, then find the immovable memory regions and store
them in an array called immovable_mem[]. With immovable_mem[], KASLR
can avoid to extract kernel to specific regions.
Signed-off-by: Chao Fan
---
arch/x86/boot
ARSE_RSDP' to make code easy to read
- Put strtoull() to misc.c
Follow Masa's suggestion:
- Remove the detection for 'movable_node'
- Change the code logical about cmdline_find_option()
v12->v13:
Follow Boris' suggestion:
- Copy kstrtoull() to boot/string.c
Follow
Y_HOTREMOVE' is needed, introduce
'CONFIG_EARLY_PARSE_RSDP' to make ifdeffery clear.
Signed-off-by: Chao Fan
---
arch/x86/Kconfig| 10 ++
arch/x86/boot/compressed/acpi.c | 30 ++
arch/x86/boot/compressed/misc.h | 6 ++
3 files change
.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpi.c | 79 +
1 file changed, 79 insertions(+)
diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index cad15686f82c..c96008712ec9 100644
--- a/arch/x86/boot/compressed/acpi.c
BIOS, there is no variable who can
point to RSDP directly, so scan memory for the RSDP and verify RSDP
by signature and checksum.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpi.c | 85 +
1 file changed, 85 insertions(+)
diff --git a/arch/x86/boot
t; I remember I just muted it with below code, please check commit
>> d52e7d5a95.
>>
>> +#define _LINUX_EXPORT_H
>> +#define EXPORT_SYMBOL(sym)
>
>I made below change, it passed. My another question is why you need
>include "lib/kstrtox.c" into misc.c. Does it make sense if you plan to
>use it to replace simple_strtoull() in arch/x86/boot/string.c ?
>
>diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
>index e51713fe3add..777e807756e8 100644
>--- a/arch/x86/boot/compressed/misc.c
>+++ b/arch/x86/boot/compressed/misc.c
>@@ -13,6 +13,8 @@
> */
>
> #define BOOT_CTYPE_H
>+#define __DISABLE_EXPORTS
>+
> #include "misc.h"
> #include "error.h"
> #include "pgtable.h"
>
>I just tried to include it into boot/string.c, there's no any problem.
Thanks for your help, I think it's better to include it into
boot/string.c.
Thanks,
Chao Fan
>
>Thanks
>Baoquan
>
>
wonder if there are some options I miss or some problems.
The patch is below.
Thanks,
Chao Fan
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index c4428a176973..62ffe0437c8e 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -13,6 +13,9 @@
*/
#include
On Wed, Dec 05, 2018 at 03:58:14PM +0100, Borislav Petkov wrote:
>On Thu, Nov 29, 2018 at 04:16:27PM +0800, Chao Fan wrote:
>> To fix the conflict between KASLR and memory-hotremove, memory
>> information in SRAT table is necessary.
>>
>> ACPI SRAT (System/Static Resour
On Tue, Dec 04, 2018 at 07:34:00PM +0100, Borislav Petkov wrote:
>On Fri, Nov 30, 2018 at 10:29:14AM +0800, Chao Fan wrote:
>> Oh, thanks, will change it
>> char val[19];
>
>And make that 19 a define.
I will do that.
Thanks,
Chao Fan
>
>--
>Regards/Gruss,
>
On Tue, Dec 04, 2018 at 07:42:20PM +0100, Borislav Petkov wrote:
>On Sat, Dec 01, 2018 at 02:05:39PM +0800, Chao Fan wrote:
>> >I built your whole patchset and got the error.
>> >The error depends on CONFIG_MODVERSIONS.
>> >If CONFIG_MODVERSIONS=y, you will get t
On Fri, Nov 30, 2018 at 09:54:33AM -0500, Masayoshi Mizuma wrote:
>On Fri, Nov 30, 2018 at 09:24:54AM +0800, Chao Fan wrote:
>> >> /* acpitb.c */
>> >> +#ifdef CONFIG_RANDOMIZE_BASE
>> >> +/* Store the amount of immovable memory regions */
>
On Fri, Nov 30, 2018 at 12:35:16PM -0500, Masayoshi Mizuma wrote:
>On Fri, Nov 30, 2018 at 10:43:47AM +0800, Chao Fan wrote:
>...
>> >]$ make arch/x86/boot/compressed/misc.o
>> > CALLscripts/checksyscalls.sh
>> > DESCEND objtool
>> > CC arch
On Fri, Nov 30, 2018 at 09:15:13AM +0800, Chao Fan wrote:
>On Thu, Nov 29, 2018 at 12:32:46PM -0500, Masayoshi Mizuma wrote:
>>Hi Chao,
>>
>>Thank you for your continued working.
>
>Thanks for your test.
>
>>
>>Could you please build your patches before
x86/boot/compressed/misc.o]
>Error 1
>make: *** [Makefile:1715: arch/x86/boot/compressed/misc.o] Error 2
>]$
Hi Masa,
So many thanks for your test.
Could you give me more details about this error? More error message.
Just on the first commit or the whole PATCHSET?
Cause I didn't get er
On Thu, Nov 29, 2018 at 11:20:13AM -0500, Masayoshi Mizuma wrote:
>On Thu, Nov 29, 2018 at 04:16:27PM +0800, Chao Fan wrote:
>> To fix the conflict between KASLR and memory-hotremove, memory
>> information in SRAT table is necessary.
>>
>> ACPI SRAT (System/Static R
On Thu, Nov 29, 2018 at 12:55:21PM -0500, Masayoshi Mizuma wrote:
>On Thu, Nov 29, 2018 at 04:16:30PM +0800, Chao Fan wrote:
>> To fix the conflict between KASLR and memory-hotremove, SRAT table
>> should be parsed by RSDP pointer, then find the immovable
>> memory regions
oblems with the method to splite patch.
I will rework on it and build every commit.
Thanks,
Chao Fan
>Your patches depend on the following kconfig,
>so please build them under the config combination.
>
>RANDOMIZE_BASE
>MEMORY_HOTREMOVE
>EARLY_PARSE_RSDP
>KEXEC
>EFI
>
>T
regions.
Add 'CONFIG_EARLY_PARSE_RSDP' which depends on RANDOMIZE_BASE &&
MEMORY_HOTREMOVE, cause only when both KASLR and memory-hotremove
are enabled, RSDP needs to be parsed in compressed period.
Signed-off-by: Chao Fan
---
arch/x86/Kconfig | 10 +++
arch/x
pointer (Root
System Description Pointer). So RSDP should be found firstly.
When booting form KEXEC/EFI/BIOS, the methods to find RSDP pointer
are different. When booting from KEXEC, 'acpi_rsdp' may have been
added to cmdline, so parse the cmdline and find the RSDP pointer.
Signed-of
CONFIG_EARLY_PARSE_RSDP is enabled, walk through the SRAT memory
tables and store those immovable memory regions so that KASLR can get
where to choose for randomization.
Also, rename process_mem_region() as __process_mem_region() and name new
function as process_mem_region().
Signed-off-by: Chao Fan
table and find the RSDP pointer.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.c | 79 +++
1 file changed, 79 insertions(+)
diff --git a/arch/x86/boot/compressed/acpitb.c
b/arch/x86/boot/compressed/acpitb.c
index 614c45655cff..c43546648638 100644
--- a
to read
- Put strtoull() to misc.c
Follow Masa's suggestion:
- Remove the detection for 'movable_node'
- Change the code logical about cmdline_find_option()
Any comments will be welcome.
Chao Fan (5):
x86/boot: Add get_acpi_rsdp() to parse RSDP in cmdline from KEXEC
x86/boot:
directly, so scan memory for the RSDP and verify RSDP
by signature and checksum.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.c | 85 +++
1 file changed, 85 insertions(+)
diff --git a/arch/x86/boot/compressed/acpitb.c
b/arch/x86/boot/compressed/acpitb.c
On Tue, Nov 13, 2018 at 06:51:50PM +0100, Borislav Petkov wrote:
>On Mon, Nov 12, 2018 at 05:46:43PM +0800, Chao Fan wrote:
>> Imitate setup_acpi_rsdp() for the early_param of 'acpi_rsdp'.
>> KEXEC writes the RSDP pointer to cmdline for EFI booting.
>> So if '
On Tue, Nov 06, 2018 at 08:13:03PM +0100, Borislav Petkov wrote:
>On Mon, Oct 22, 2018 at 05:37:15PM +0800, Chao Fan wrote:
>> kstrtoull() lives in 'uncompressed' period, used to
>> convert a string to an unsigned long long.
>> Copy to 'compressed' so th
the code from Chao's patch, but not the variable. Means we need
>go through the SRAT accessing again in arch/x86/mm/kaslr.c and fill
>immovable_mem[num_immovable_mem] for mm/kaslr.c usage, if we decide to
>do like that.
Reading three times is redundant, but reading two times is needed.
Becasue the ACPI code run very stable, but we need more information
before that.
As for Masa's issue, I am wondering whether we can tranfer the
information or only the address of SRAT table from compressed period
to the period after start_kernel().
Thanks,
Chao Fan
>
>Thanks
>Baoquan
>
>
On Tue, Sep 11, 2018 at 09:28:44AM +0200, Rafael J. Wysocki wrote:
>On Tue, Sep 11, 2018 at 3:13 AM Chao Fan wrote:
>>
>> sorry, the cover letter forwand to rafael.
>
>Thanks, but the relevant information still needs to go to the
>changelog of the patch adding the extra
Commit-ID: 44060e8a5189fd79220a94422b8249a85e91
Gitweb: https://git.kernel.org/tip/44060e8a5189fd79220a94422b8249a85e91
Author: Chao Fan
AuthorDate: Tue, 7 Aug 2018 09:57:05 +0800
Committer: Ingo Molnar
CommitDate: Mon, 10 Sep 2018 15:07:11 +0200
x86/boot/KASLR: Remove return
sorry, the cover letter forwand to rafael.
Thanks,
Chao Fan
On Mon, Sep 10, 2018 at 08:40:12PM +0800, Chao Fan wrote:
>***Background:
>People reported that kaslr may randomly chooses some positions
>which are located in movable memory regions. This will break memory
>hotplug feature
meter
v5->v6:
Follow Baoquan He's suggestion:
- Change some log.
- Add the check for acpi_rsdp
- Change some code logical to make code clear
Any comments will be welcome.
Chao Fan (3):
x86/boot: Add acpitb.c to parse acpi tables
x86/boot/KASLR: Walk srat tables to filter immovable memory
If CONFIG_MEMORY_HOTREMOVE enabled, walk through the acpi srat memory
tables and store those immovable memory regions so that kaslr can get
where to choose for randomization.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 10 ++
1 file changed, 10 insertions(+)
diff
If CONFIG_MEMORY_HOTREMOVE enabled and the amount of immovable
memory regions is not zero. Calculate the intersection between memory
regions from e820/efi memory table and immovable memory regions.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 66
On Thu, Sep 06, 2018 at 01:58:08PM +0800, Pingfan Liu wrote:
>On Thu, Sep 6, 2018 at 12:07 PM Chao Fan wrote:
>>
>> On Thu, Sep 06, 2018 at 10:36:19AM +0800, Pingfan Liu wrote:
>>
>> Hi Pingfan,
>>
>> >commit 747ff6265db4 ("x86/boot/KASLR: Skip sp
ment of randomness.
Such as your example,
in 4G, the probability every slot chosen is about 0.00049
in 5G, the probability every slot chosen is about 0.00039
Yes, you did improve 25% for randomness. But I wonder if it's worth to
improve from 0.00049 to 0.00039.
If there is something wrong in my u
On Mon, Aug 27, 2018 at 02:28:54PM +0800, Chao Fan wrote:
>On Mon, Aug 27, 2018 at 01:56:07PM +0800, Baoquan He wrote:
>>On 08/07/18 at 02:50pm, Chao Fan wrote:
[...]
>>
>>Is it possible to take num_immovable_mem definition out from #ifdef
>>CONFIG_MEMORY_HOTREMOVE b
On Mon, Aug 27, 2018 at 01:56:07PM +0800, Baoquan He wrote:
>On 08/07/18 at 02:50pm, Chao Fan wrote:
>> If 'CONFIG_MEMORY_HOTREMOVE' specified and the account of immovable
>If CONFIG_MEMORY_HOTREMOVE is enabled,
>> memory regions is not zero. Calculate the intersecti
On Mon, Aug 27, 2018 at 10:13:49AM +0800, Baoquan He wrote:
>On 08/07/18 at 02:49pm, Chao Fan wrote:
>> If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
>> tables, store the immovable memory regions, so that kaslr can get
>> the information abou
it to a suitable place.
May the position where we try to get the acpi table is better.
Or just here is also OK.
Thanks,
Chao Fan
>
Hi all,
No reply for 2 weeks, any comments?
Thanks,
Chao Fan
On Tue, Aug 07, 2018 at 02:49:56PM +0800, Chao Fan wrote:
>***Background:
>People reported that kaslr may randomly chooses some positions
>which are located in movable memory regions. This will break memory
>hotplug feat
tch_random,
and name new function as process_mem_region.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 66 ++--
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 72
If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
tables, store the immovable memory regions, so that kaslr can get
the information abouth where can be selected or not.
If 'CONFIG_MEMORY_HOTREMOVE' not specified, go on the old code.
Signed-off-by: Chao Fan
Imitate the ACPI code to parse ACPI tables. Functions are simplified
cause some operations are not needed here.
And also, this method won't influence the initialization of ACPI.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/Makefile | 4 +
arch/x86/boot/compressed/acpitb.c
In order to parse ACPI tables, reuse the head file linux/acpi.h,
so that the files in 'compressed' directory can read ACPI table
by including this head file.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.h | 7 +++
1 file changed, 7 insertions(+)
create mode 10064
to #define CONFIG_EFI and return
false in the other stub.
- Simplify two functions in head file.
v4->v5:
Follow Dou Liyang's suggestion:
- Add more comments about some functions based on kernel code.
- Change some typo in comments.
- Clean useless variable.
- Add check for the bounda
Since function "handle_mem_options" is used only once:
arch/x86/boot/compressed/kaslr.c:421
handle_mem_options();
The return value is useless, so change it to void.
And also clean a useless variable.
Suggested-by: Dou Liyang
Signed-off-by: Chao Fan
---
arch/x86/boot/compress
On Fri, Aug 03, 2018 at 10:00:48AM +0800, Dou Liyang wrote:
>
>
>At 07/23/2018 05:29 PM, Chao Fan wrote:
>> Imitate the ACPI code to parse ACPI tables. Functions are simplified
>> cause some operations are not needed here.
>> And also, this method won't infl
On Thu, Aug 02, 2018 at 01:46:29PM +0800, Dou Liyang wrote:
>Hi Fan,
>
>At 07/23/2018 05:29 PM, Chao Fan wrote:
>> If 'CONFIG_MEMORY_HOTREMOVE' specified and the account of immovable
>> memory regions is not zero. Calculate the intersection between memory
>> r
On Thu, Aug 02, 2018 at 11:47:13AM +0800, Dou Liyang wrote:
>Hi Fan,
>
>At 07/23/2018 05:29 PM, Chao Fan wrote:
>> If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
>> tables, store the immovable memory regions, so that kaslr can get
>> the inf
Hi,
Sorry for disturbance, no reply for a week, any comments?
Thanks,
Chao Fan
On Mon, Jul 23, 2018 at 05:29:04PM +0800, Chao Fan wrote:
>***Background:
>People reported that kaslr may randomly chooses some positions
>which are located in movable memory regions. This will break memory
On Tue, Jul 24, 2018 at 02:02:57PM +0800, Baoquan He wrote:
>Hi chao,
>
>On 07/23/18 at 05:29pm, Chao Fan wrote:
>> In order to parse ACPI tables, reuse the head file linux/acpi.h,
>> so that the files in 'compressed' directory can read ACPI table
>> by includ
On Tue, Jul 24, 2018 at 02:02:57PM +0800, Baoquan He wrote:
>Hi chao,
>
>On 07/23/18 at 05:29pm, Chao Fan wrote:
>> In order to parse ACPI tables, reuse the head file linux/acpi.h,
>> so that the files in 'compressed' directory can read ACPI table
>> by includ
Imitate the ACPI code to parse ACPI tables. Functions are simplified
cause some operations are not needed here.
And also, this method won't influence the initialization of ACPI.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/Makefile | 4 +
arch/x86/boot/compressed/acpitb.c
tch_random,
and name new function as process_mem_region.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 66 ++--
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 47
If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
tables, store the immovable memory regions, so that kaslr can get
the information abouth where can be selected or not.
If 'CONFIG_MEMORY_HOTREMOVE' not specified, go on the old code.
Signed-off-by: Chao Fan
In order to parse ACPI tables, reuse the head file linux/acpi.h,
so that the files in 'compressed' directory can read ACPI table
by including this head file.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.h | 7 +++
1 file changed, 7 insertions(+)
create mode 10064
to #define CONFIG_EFI and return
false in the other stub.
- Simplify two functions in head file.
Any comments will be welcome.
Chao Fan (4):
x86/boot: Add acpitb.h to help parse acpi tables
x86/boot: Add acpitb.c to parse acpi tables
x86/boot/KASLR: Walk srat tables to filter immovab
On Thu, Jul 19, 2018 at 05:19:43PM +0200, Thomas Gleixner wrote:
>On Tue, 17 Jul 2018, Chao Fan wrote:
>
>> In order to parse ACPI tables, reuse the head file linux/acpi.h,
>> so that the files in 'compressed' directory can read ACPI table
>> by including this hea
On Thu, Jul 19, 2018 at 05:22:35PM +0200, Thomas Gleixner wrote:
>On Tue, 17 Jul 2018, Chao Fan wrote:
>> +
>> +/* Search efi table for rsdp table. */
>> +static bool efi_get_rsdp_addr(acpi_physical_address *rsdp_addr)
>> +{
>> +efi_system_table_t *systa
Imitate the ACPI code to parse ACPI tables. Functions are simplified
cause some operations are not needed here.
And also, this method won't influence the initialization of ACPI.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/Makefile | 4 +
arch/x86/boot/compressed/acpitb.c
In order to parse ACPI tables, reuse the head file linux/acpi.h,
so that the files in 'compressed' directory can read ACPI table
by including this head file.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.h | 50 +++
1 file changed, 50
tch_random,
and name new function as process_mem_region.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 66 ++--
1 file changed, 55 insertions(+), 11 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index c3
->v2:
- Simplify some code.
Follow Baoquan He's suggestion:
- Reuse the head file of acpi code.
v2->v3:
- Test in more conditions, so remove the 'RFC' tag.
- Change some comments.
Any comments will be welcome.
Chao Fan (4):
x86/boot: Add acpitb.h to help parse acpi
If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
tables, store the immovable memory regions, so that kaslr can get
the information abouth where can be selected or not.
If 'CONFIG_MEMORY_HOTREMOVE' not specified, go on the old code.
Signed-off-by: Chao Fan
On Mon, Jul 16, 2018 at 01:44:47PM +0200, Ingo Molnar wrote:
>
>* Chao Fan wrote:
>
>> If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
>> tables, store the immovable memory regions, so that kaslr can get
>> the information about
Imitate the ACPI code to parse ACPI tables. Functions are simplified
cause some operations are not needed here.
And also, this method won't influence the initialization of ACPI.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/Makefile | 4 +
arch/x86/boot/compressed/acpitb.c
If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
tables, store the immovable memory regions, so that kaslr can get
the information abouth where can be selected or not.
If 'CONFIG_MEMORY_HOTREMOVE' not specified, go on the old code.
Signed-off-by: Chao Fan
tch_random,
and name new function as process_mem_region.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 65 ++--
1 file changed, 54 insertions(+), 11 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 0e
In order to parse ACPI tables, reuse the head file linux/acpi.h,
so that the files in 'compressed' directory can read ACPI table
by including this head file.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.h | 49 +++
1 file changed, 49
->v2:
- Simplify some code.
Follow Baoquan He's suggestion:
- Reuse the head file of acpi code.
Any comments will be welcome.
Chao Fan (4):
x86/boot: Add acpitb.h to help parse acpi tables
x86/boot: Add acpitb.c to parse acpi tables
x86/boot/KASLR: Walk srat tables to filter i
On Fri, Jul 13, 2018 at 07:52:40AM +0800, Baoquan He wrote:
>Hi Michal,
>
>On 07/12/18 at 02:32pm, Michal Hocko wrote:
>> On Thu 12-07-18 14:01:15, Chao Fan wrote:
>> > On Thu, Jul 12, 2018 at 01:49:49PM +0800, Dou Liyang wrote:
>> > >Hi Baoquan,
>> &g
e you had a chance to fix
>this in the KASLR side.
>
I think it's better to fix here, but not KASLR side.
Cause much more code will be change if doing it in KASLR side.
Since we didn't parse 'kernelcore' in compressed code, and you can see
the distribution of ZONE_MOVABLE need
unsigned long kernel_pages;
I think the logic of these two method are the same, and this method
change less code. If I am wrong, please let me know.
Thanks,
Chao Fan
>
>+ /*
>+ * KASLR may put kernel near
G of first kernel
and last 11G as ZONE_MOVABLE of other 9 nodes as ZONE_MOVABLE.
Thanks,
Chao Fan
On Wed, Jul 11, 2018 at 05:42:44PM +0800, Chao Fan wrote:
>Hi all,
>
>I found there is a BUG about KASLR and ZONE_MOVABLE.
>
>When users use 'kernelcore=' parameter without
On Wed, Jul 11, 2018 at 05:42:44PM +0800, Chao Fan wrote:
>Hi all,
>
>I found there is a BUG about KASLR and ZONE_MOVABLE.
>
>When users use 'kernelcore=' parameter without 'movable_node',
>movable memory is evenly distributed to all nodes. The size of
>ZON
_pfns_for_nodes() of mm/page_alloc.c. If kernel is uncompressed
in a tail position, then just set the memory after the kernel as ZONE_MOVABLE,
at the same time, memory in other nodes will be set as ZONE_MOVABLE.
If there is something wrong, pleas let me know. And any comments will be
welcome.
Thanks,
Chao Fan
On Tue, Jul 03, 2018 at 09:39:02AM +0800, Baoquan He wrote:
>On 07/03/18 at 09:32am, Chao Fan wrote:
>> On Mon, Jul 02, 2018 at 08:18:55PM +0800, Baoquan He wrote:
>> >Hi Chao,
>> >
>> >On 06/12/18 at 04:10pm, Chao Fan wrote:
>> >> *** Issues need
On Mon, Jul 02, 2018 at 08:18:55PM +0800, Baoquan He wrote:
>Hi Chao,
>
>On 06/12/18 at 04:10pm, Chao Fan wrote:
>> *** Issues need be discussed
>> There are several issues I am not quite sure, please help review and
>> give suggestions:
>>
>> 1) In PATCH
If 'CONFIG_MEMORY_HOTREMOVE' specified, walk the acpi srat memory
tables, store the immovable memory regions, so that kaslr can get
the information abouth where can be selected or not.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 55 ++
tables in 'compressed' directory.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/acpitb.h | 175 ++
1 file changed, 175 insertions(+)
create mode 100644 arch/x86/boot/compressed/acpitb.h
diff --git a/arch/x86/boot/compressed/acpitb.h
b/arch/x86/boot/
To get more information about memory, acpi tables should be parsed.
But can't use ACPI code directely, so imitate the ACPI code to dig
the useful srat tables from ACPI tables.
Only dig the useful tables, and don't influence the initialization
of ACPI.
Signed-off-by: Chao Fan
---
arc
unction as process_mem_region.
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 65 ++--
1 file changed, 54 insertions(+), 11 deletions(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 4edff0501540..a0a07e549
e tests, so it's with RFC tag.
Any comments will be welcome.
Chao Fan (4):
x86/boot: Add acpitb.h to help parse acpi tables
x86/boot: Add acpitb.c to parse acpi tables
x86/boot/KASLR: Walk srat tables to filter immovable memory
x86/boot/KASLR: Limit kaslr to choosing the immovable
On Thu, May 17, 2018 at 12:03:43PM +0800, Baoquan He wrote:
>Hi Chao,
>
>On 05/17/18 at 11:27am, Chao Fan wrote:
>> >+/* Store the number of 1GB huge pages which user specified.*/
>> >+static unsigned long max_gb_huge_pages;
>> >+
>> >+static i
if (size >= image_size) {
>+ tmp.start = addr + i*PUD_SIZE;
>+ tmp.size = size;
>+ store_slot_info(&tmp, image_size);
>+}
I have another question not related to kaslr.
Here you try to avoid the memory from addr to (addr + i * PUD_SIZE),
but I wonder if after walking all memory regions, 'max_gb_huge_pages'
is still more than 0, which means there isn't enough memory slots for
huge page, what will happen?
Thanks,
Chao Fan
>+}
>+
> static unsigned long slots_fetch_random(void)
> {
> unsigned long slot;
>--
>2.13.6
>
>
>
On Mon, Mar 19, 2018 at 03:24:46PM +0800, Baoquan He wrote:
>On 03/12/18 at 08:04pm, Chao Fan wrote:
>> On Mon, Mar 12, 2018 at 11:57:27AM +0100, Ingo Molnar wrote:
>> >
>> >* Baoquan He wrote:
>> >
>> >> Hi Ingo,
>> >>
>> >>
On Mon, Mar 12, 2018 at 11:57:27AM +0100, Ingo Molnar wrote:
>
>* Baoquan He wrote:
>
>> Hi Ingo,
>>
>> On 03/12/18 at 10:35am, Ingo Molnar wrote:
>> >
>> > * Chao Fan wrote:
>> >
>> > > Long time no reply, rebase
d 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 Liyang's suggestion:
- Add the parse for movable_node=nn[KMG] without @ss[KMG]
- Fix the bug for more t
In kernel code, if 'movable_node' specified, it will skip the mirror
feature. So also skip mirror feature in KASLR.
Signed-off-by: Chao Fan
Acked-by: Baoquan He
---
arch/x86/boot/compressed/kaslr.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/boot/compressed
_mem_region.
Signed-off-by: Chao Fan
Tested-by: Luiz Capitulino
Acked-by: Baoquan He
---
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/comp
movable regions, this will make memory hotplug fail.
With the help of 'kaslr_boot_mem=', limit kernel in those immovable regions
specified.
Signed-off-by: Chao Fan
Tested-by: Luiz Capitulino
Acked-by: Baoquan He
---
arch/x86/boot/compressed/kaslr.c | 73 +
Since only 'movable_node' specified without 'kaslr_boot_mem=' may
break memory hotplug, so reconmmend users using 'kaslr_boot_mem='
when 'movable_node' specified.
Signed-off-by: Chao Fan
Acked-by: Baoquan He
---
arch/x86/boot/compressed/kaslr.c | 10 +
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
Hi Kees,
Since no reply for one week, any suggestions for this version?
Thanks,
Chao Fan
On Tue, Jan 23, 2018 at 04:35:41PM +0800, Chao Fan wrote:
>This is v8 resend. There's no code change. Just improve code comments
>and document accordingly. So add Baoquan's Acked-by and L
Since only 'movable_node' specified without 'kaslr_mem=' may break
memory hotplug, so reconmmend users using 'kaslr_mem=' when
'movable_node' specified.
Acked-by: Baoquan He
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 10 ++
regions, this will make memory hotplug fail.
With the help of 'kaslr_mem=', limit kernel in those immovable regions
specified.
Tested-by: Luiz Capitulino
Acked-by: Baoquan He
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 73 ++
In kernel code, if 'movable_node' specified, it will skip the mirror
feature. So also skip mirror feature in KASLR.
Acked-by: Baoquan He
Signed-off-by: Chao Fan
---
arch/x86/boot/compressed/kaslr.c | 7 +++
1 file changed, 7 insertions(+)
diff --git a/arch/x86/boot/compressed
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
on.
Tested-by: Luiz Capitulino
Acked-by: Baoquan He
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.
101 - 200 of 317 matches
Mail list logo