Skip to content

x86/power/64: Make KASLR memory randomization compatible with hibernation

Thomas Garnier kernel-hardening linux-pm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 13 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2x86/power/64: Support unaligned addresses for temporary mappingarch/x86/mm/ident_map.c+10 -814 replies
2/2x86/power/64: Fix __PAGE_OFFSET usage on restorearch/x86/power/hibernate_asm_64.S+11 -111 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchRafael J. WysockiThomas GarnierPavel MachekYinghai Lu
1/2A-b A-b A-b
2/2Reported-and-tested-by A-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [PATCH v1 0/2] x86/power/64: Make KASLR memory randomization compatible with hibernation

***Background:
KASLR memory randomization for x86_64 was added when KASLR did not support hibernation. Now that it does, some changes are needed.

***Problems that needed solving:
Hibernation was failing on reboot with a GP fault when CONFIG_RANDOMIZE_MEMORY was enabled. Two issues were identified.

The original fault was due to a wrong physical address assigned to cr3. The problem was introduced with __PAGE_OFFSET becoming a global variable when randomized. The fix uses a define to use the glbobal or immediate value based on config settings.

The second isssue was that the temporary page table mapping did not support virtual addresses not aligned on PGD level. KASLR memory randomization will generated a random address aligned on PUD level. The fix correctly calculates the offset on all levels of the temporary page table.

***Parts:
- 01/02: Support unaligned addresses (second issue)
- 02/02: Fix __PAGE_OFFSET usage on assembly (first issue)