mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] x86/realmode: Pad the embedded real-mode blob to a page boundary
@ 2026-09-17 11:49 Thorsten Blum
  2026-09-17 23:21 ` H. Peter Anvin
  0 siblings, 1 reply; 2+ messages in thread
From: Thorsten Blum @ 2026-09-17 11:49 UTC (permalink / raw)
  To: Thomas Gleixner, Ingo Molnar, Borislav Petkov, Dave Hansen, x86,
	H. Peter Anvin, Jarkko Sakkinen
  Cc: Thorsten Blum, H. Peter Anvin, linux-kernel

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")
Signed-off-by: Thorsten Blum <blum@kernel.org>
---
 arch/x86/realmode/rmpiggy.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/realmode/rmpiggy.S b/arch/x86/realmode/rmpiggy.S
index c8fef76743f6..ce5350241238 100644
--- a/arch/x86/realmode/rmpiggy.S
+++ b/arch/x86/realmode/rmpiggy.S
@@ -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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] x86/realmode: Pad the embedded real-mode blob to a page boundary
  2026-09-17 11:49 [PATCH] x86/realmode: Pad the embedded real-mode blob to a page boundary Thorsten Blum
@ 2026-09-17 23:21 ` H. Peter Anvin
  0 siblings, 0 replies; 2+ messages in thread
From: H. Peter Anvin @ 2026-09-17 23:21 UTC (permalink / raw)
  To: Thorsten Blum, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	Dave Hansen, x86, Jarkko Sakkinen
  Cc: H. Peter Anvin, linux-kernel

On September 17, 2026 4:49:27 AM PDT, Thorsten Blum <blum@kernel.org> wrote:
>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")
>Signed-off-by: Thorsten Blum <blum@kernel.org>
>---
> arch/x86/realmode/rmpiggy.S | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/arch/x86/realmode/rmpiggy.S b/arch/x86/realmode/rmpiggy.S
>index c8fef76743f6..ce5350241238 100644
>--- a/arch/x86/realmode/rmpiggy.S
>+++ b/arch/x86/realmode/rmpiggy.S
>@@ -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)

Acked-by: H. Peter Anvin <hpa@zytor.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-17 23:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-17 11:49 [PATCH] x86/realmode: Pad the embedded real-mode blob to a page boundary Thorsten Blum
2026-09-17 23:21 ` H. Peter Anvin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®