]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
x86/sev: Don't emit BSS_DECRYPTED section unless it is in use
authorArd Biesheuvel <ardb@kernel.org>
Thu, 8 Jan 2026 09:25:29 +0000 (09:25 +0000)
committerBorislav Petkov (AMD) <bp@alien8.de>
Sat, 31 Jan 2026 13:42:53 +0000 (14:42 +0100)
commit8c89d3ad3095808ac130c535ad7ed3d1344d5986
tree8527b43049b9ff688c93ffe1cb44d8835e7ec1b3
parentaf05e558988ed004a20fc4de7d0f80cfbba663f0
x86/sev: Don't emit BSS_DECRYPTED section unless it is in use

The BSS_DECRYPTED section that gets emitted into .bss will be empty if
CONFIG_AMD_MEM_ENCRYPT is not defined. However, due to the fact that it
is injected into .bss rather than emitted as a separate section, the
2 MiB alignment that it specifies is still taken into account
unconditionally, pushing .bss out to the next 2 MiB boundary, leaving
a gap that is never freed.

So only emit a non-empty BSS_DECRYPTED section if it is going to be
used.  In that case, it would still be nice to free the padding, but
that is left for later.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Link: https://patch.msgid.link/20260108092526.28586-23-ardb@kernel.org
arch/x86/kernel/vmlinux.lds.S