Commit f6c4fd50 authored by Thomas Gleixner's avatar Thomas Gleixner

x86/cpu_entry_area: Prevent wraparound in setup_cpu_entry_area_ptes() on 32bit

The loop which populates the CPU entry area PMDs can wrap around on 32bit
machines when the number of CPUs is small.

It worked wonderful for NR_CPUS=64 for whatever reason and the moron who
wrote that code did not bother to test it with !SMP.

Check for the wraparound to fix it.

Fixes: 92a0f81d ("x86/cpu_entry_area: Move it out of the fixmap")
Reported-by: default avatarkernel test robot <fengguang.wu@intel.com>
Signed-off-by: default avatarThomas "Feels stupid" Gleixner <tglx@linutronix.de>
Tested-by: default avatarBorislav Petkov <bp@alien8.de>
parent 613e396b
...@@ -122,7 +122,8 @@ static __init void setup_cpu_entry_area_ptes(void) ...@@ -122,7 +122,8 @@ static __init void setup_cpu_entry_area_ptes(void)
start = CPU_ENTRY_AREA_BASE; start = CPU_ENTRY_AREA_BASE;
end = start + CPU_ENTRY_AREA_MAP_SIZE; end = start + CPU_ENTRY_AREA_MAP_SIZE;
for (; start < end; start += PMD_SIZE) /* Careful here: start + PMD_SIZE might wrap around */
for (; start < end && start >= CPU_ENTRY_AREA_BASE; start += PMD_SIZE)
populate_extra_pte(start); populate_extra_pte(start);
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment