blob: e684dd51856fa34c0a9ca0a764c64c0ac95691ce [file] [log] [blame]
From: "Mike Rapoport (Microsoft)" <rppt@kernel.org>
Subject: x86/alternatives: fix writable address in cfi_rewrite_endbr()
Date: Tue, 5 Nov 2024 10:49:57 +0200
Commit ("x86/module: prepare module loading for ROX allocations of text")
missed the offset that should be added to the writable address passed to
poison_endbr() from cfi_rewrite_endbr() and this causes boot failures on
kernels running with cfi=fineibt on machines that support IBT.
Add required offset to wr_addr argument to fix the issue.
Link: https://lkml.kernel.org/r/ZysRwR29Ji8CcbXc@kernel.org
Signed-off-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
arch/x86/kernel/alternative.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/arch/x86/kernel/alternative.c~x86-module-prepare-module-loading-for-rox-allocations-of-text-fix
+++ a/arch/x86/kernel/alternative.c
@@ -1241,7 +1241,7 @@ static void cfi_rewrite_endbr(s32 *start
void *addr = (void *)s + *s;
void *wr_addr = module_writable_address(mod, addr);
- poison_endbr(addr+16, wr_addr, false);
+ poison_endbr(addr + 16, wr_addr + 16, false);
}
}
_