Skip to contentSkip to conversation

x86/realmode: Pad the embedded real-mode blob to a page boundary

PATCH Superseded Thorsten Blum 2 participants 3 messages Sep 17 – Oct 5 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/realmode: Pad the embedded real-mode blob to a page boundary

setup_real_mode() copies the page-aligned size of the embedded real-mode blob into low memory. However, real_mode_blob ends immediately before real_mode_relocs, so the copy includes relocation data and potentially other .init.data contents when the size of realmode.bin is not page-aligned.

Pad real_mode_blob to a page boundary so the copy contains only the real-mode binary and its padding.

Fixes 084ee1c641a0 ("x86, realmode: Relocator for realmode code")
---
 arch/x86/realmode/rmpiggy.S | 1 +
 1 file changed, 1 insertion(+)
arch/x86/realmode/rmpiggy.S +1 -0
index c8fef76743f6..ce5350241238 100644
@@ -12,6 +12,7 @@
 
 SYM_DATA_START(real_mode_blob)
 	.incbin	"arch/x86/realmode/rm/realmode.bin"
+	.balign PAGE_SIZE
 SYM_DATA_END_LABEL(real_mode_blob, SYM_L_GLOBAL, real_mode_blob_end)
 
 SYM_DATA_START(real_mode_relocs)
reviewer Acked-by on v1 1/1
#1 lore raw
Quoted 20 lines · Thorsten Blum

setup_real_mode() copies the page-aligned size of the embedded real-mode blob into low memory. However, real_mode_blob ends immediately before real_mode_relocs, so the copy includes relocation data and potentially other .init.data contents when the size of realmode.bin is not page-aligned.

Pad real_mode_blob to a page boundary so the copy contains only the real-mode binary and its padding.

Fixes 084ee1c641a0 ("x86, realmode: Relocator for realmode code")

---
arch/x86/realmode/rmpiggy.S | 1 +

1 file changed, 1 insertion(+)
arch/x86/realmode/rmpiggy.S +0 -0
index c8fef76743f6..ce5350241238 100644

arch/x86/realmode/rmpiggy.S line 18

Quoted 7 lines
arch/x86/realmode/rmpiggy.S +1 -0
@@ -12,6 +12,7 @@
 
 SYM_DATA_START(real_mode_blob)
 	.incbin	"arch/x86/realmode/rm/realmode.bin"
+	.balign PAGE_SIZE
 SYM_DATA_END_LABEL(real_mode_blob, SYM_L_GLOBAL, real_mode_blob_end)
 
 SYM_DATA_START(real_mode_relocs)
#2 lore raw
In reply to Thorsten Blum
Quoted 6 lines · Thorsten Blum

setup_real_mode() copies the page-aligned size of the embedded real-mode blob into low memory. However, real_mode_blob ends immediately before real_mode_relocs, so the copy includes relocation data and potentially other .init.data contents when the size of realmode.bin is not page-aligned.

Quoted 8 lines

Pad real_mode_blob to a page boundary so the copy contains only the real-mode binary and its padding.

Fixes 084ee1c641a0 ("x86, realmode: Relocator for realmode code")
---
 arch/x86/realmode/rmpiggy.S | 1 +
 1 file changed, 1 insertion(+)

Gentle ping. Could this be picked up with the Acked-by from hpa?

Thanks,
Thorsten