diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2024-09-05 16:12:07 +0200 |
---|---|---|
committer | Michael Tokarev <mjt@tls.msk.ru> | 2024-12-17 14:14:38 +0300 |
commit | c8269bdd6817a359e5a3f1e653a01010992ae7a7 (patch) | |
tree | 1e5776b3a2fa671925ed6a7900fd7e9e362adca6 | |
parent | 86f0cfa0efd13eae38d78eee953f24017f5cdb89 (diff) | |
download | qemu-c8269bdd6817a359e5a3f1e653a01010992ae7a7.zip qemu-c8269bdd6817a359e5a3f1e653a01010992ae7a7.tar.gz qemu-c8269bdd6817a359e5a3f1e653a01010992ae7a7.tar.bz2 |
x86/loader: only patch linux kernels
If the binary loaded via -kernel is *not* a linux kernel (in which
case protocol == 0), do not patch the linux kernel header fields.
It's (a) pointless and (b) might break binaries by random patching
and (c) changes the binary hash which in turn breaks secure boot
verification.
Background: OVMF happily loads and runs not only linux kernels but
any efi binary via direct kernel boot.
Note: Breaking the secure boot verification is a problem for linux
kernels too, but fixed that is left for another day ...
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-ID: <20240905141211.1253307-3-kraxel@redhat.com>
(cherry picked from commit 57e2cc9abf5da38f600354fe920ff20e719607b4)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
-rw-r--r-- | hw/i386/x86-common.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/i386/x86-common.c b/hw/i386/x86-common.c index 992ea1f..b52903c 100644 --- a/hw/i386/x86-common.c +++ b/hw/i386/x86-common.c @@ -943,7 +943,7 @@ void x86_load_linux(X86MachineState *x86ms, * kernel on the other side of the fw_cfg interface matches the hash of the * file the user passed in. */ - if (!sev_enabled()) { + if (!sev_enabled() && protocol > 0) { memcpy(setup, header, MIN(sizeof(header), setup_size)); } |