]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
efi/libstub: Synchronize instruction cache after kernel relocation
authorWANG Rui <r@hev.cc>
Mon, 27 Apr 2026 08:47:21 +0000 (16:47 +0800)
committerArd Biesheuvel <ardb@kernel.org>
Wed, 29 Apr 2026 06:56:16 +0000 (08:56 +0200)
commitcda92ac47c024d84f6b8294e462d6272039a10ac
treeeb3fe3b9fb83e1f40b9db3eedacd50a9982bec38
parentad6f4f3ea72f866176f9dd6031c8778da088c686
efi/libstub: Synchronize instruction cache after kernel relocation

The relocated kernel image is copied to its new location using memcpy().
On architectures with separate instruction and data caches, the copied
instructions may remain stale in the instruction cache, leading to the
execution of outdated contents.

Call efi_cache_sync_image() after the relocation copy to ensure the
instruction cache is synchronized with the updated memory contents before
control is transferred to the relocated kernel.

Signed-off-by: WANG Rui <r@hev.cc>
Reviewed-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
drivers/firmware/efi/libstub/loongarch-stub.c