File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -936,8 +936,6 @@ void __init setup_arch(char **cmdline_p)
936
936
937
937
x86_init .oem .arch_setup ();
938
938
939
- kernel_randomize_memory ();
940
-
941
939
iomem_resource .end = (1ULL << boot_cpu_data .x86_phys_bits ) - 1 ;
942
940
setup_memory_map ();
943
941
parse_setup_data ();
@@ -1055,6 +1053,12 @@ void __init setup_arch(char **cmdline_p)
1055
1053
1056
1054
max_possible_pfn = max_pfn ;
1057
1055
1056
+ /*
1057
+ * Define random base addresses for memory sections after max_pfn is
1058
+ * defined and before each memory section base is used.
1059
+ */
1060
+ kernel_randomize_memory ();
1061
+
1058
1062
#ifdef CONFIG_X86_32
1059
1063
/* max_low_pfn get updated here */
1060
1064
find_low_pfn_range ();
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ void __init kernel_randomize_memory(void)
97
97
* add padding if needed (especially for memory hotplug support).
98
98
*/
99
99
BUG_ON (kaslr_regions [0 ].base != & page_offset_base );
100
- memory_tb = (( max_pfn << PAGE_SHIFT ) >> TB_SHIFT ) +
100
+ memory_tb = DIV_ROUND_UP ( max_pfn << PAGE_SHIFT , 1UL << TB_SHIFT ) +
101
101
CONFIG_RANDOMIZE_MEMORY_PHYSICAL_PADDING ;
102
102
103
103
/* Adapt phyiscal memory region size based on available memory */
You can’t perform that action at this time.
0 commit comments