Skip to content

Commit

Permalink
x86/asm, x86/microcode: Add __PAGE_OFFSET_BASE define on 32-bit
Browse files Browse the repository at this point in the history
... in order to avoid #ifdeffery in code computing the ASLR randomization
offset. Remove that #ifdeffery in the microcode loader.

Suggested-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicolai Stange <nicstange@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Garnier <thgarnie@google.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: http://lkml.kernel.org/r/20160727120939.GA18911@nazgul.tnic
Signed-off-by: Ingo Molnar <mingo@kernel.org>
  • Loading branch information
Borislav Petkov authored and Ingo Molnar committed Jul 27, 2016
1 parent df15929 commit 4a1a8e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 2 additions & 1 deletion arch/x86/include/asm/page_32_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
* If you want more physical memory than this then see the CONFIG_HIGHMEM4G
* and CONFIG_HIGHMEM64G options in the kernel configuration.
*/
#define __PAGE_OFFSET _AC(CONFIG_PAGE_OFFSET, UL)
#define __PAGE_OFFSET_BASE _AC(CONFIG_PAGE_OFFSET, UL)
#define __PAGE_OFFSET __PAGE_OFFSET_BASE

#define __START_KERNEL_map __PAGE_OFFSET

Expand Down
2 changes: 0 additions & 2 deletions arch/x86/kernel/cpu/microcode/intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -818,13 +818,11 @@ void load_ucode_intel_ap(void)
if (blobs_p->valid) {
start = blobs_p->start;

#ifdef CONFIG_RANDOMIZE_MEMORY
/*
* Pay attention to CONFIG_RANDOMIZE_MEMORY=y as it shuffles
* physmem mapping too and there we have the initrd.
*/
start += PAGE_OFFSET - __PAGE_OFFSET_BASE;
#endif
}

collect_cpu_info_early(&uci);
Expand Down

0 comments on commit 4a1a8e1

Please sign in to comment.