lkml.org 
[lkml]   [2017]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3 3/4] kaslr: disable memory mirror feature when movable_node specified
Date
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 <fanc.fnst@cn.fujitsu.com>
---
arch/x86/boot/compressed/kaslr.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index e3a3b6132da0..fc798d6d608d 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -677,6 +677,7 @@ static bool
process_efi_entries(unsigned long minimum, unsigned long image_size)
{
struct efi_info *e = &boot_params->efi_info;
+ char *args = (char *)get_cmd_line_ptr();
bool efi_mirror_found = false;
struct mem_vector region;
efi_memory_desc_t *md;
@@ -702,11 +703,15 @@ process_efi_entries(unsigned long minimum, unsigned long image_size)
#endif

nr_desc = e->efi_memmap_size / e->efi_memdesc_size;
- for (i = 0; i < nr_desc; i++) {
- md = efi_early_memdesc_ptr(pmap, e->efi_memdesc_size, i);
- if (md->attribute & EFI_MEMORY_MORE_RELIABLE) {
- efi_mirror_found = true;
- break;
+
+ /* Skip memory mirror if movabale_node or immovable_mem specified */
+ if (!strstr(args, "movable_node") && !strstr(args, "immovable_mem")) {
+ for (i = 0; i < nr_desc; i++) {
+ md = efi_early_memdesc_ptr(pmap, e->efi_memdesc_size, i);
+ if (md->attribute & EFI_MEMORY_MORE_RELIABLE) {
+ efi_mirror_found = true;
+ break;
+ }
}
}

--
2.14.3


\
 
 \ /
  Last update: 2017-12-05 09:54    [W:0.030 / U:0.316 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site