aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUros Bizjak <[email protected]>2023-12-01 09:57:27 +0100
committerIngo Molnar <[email protected]>2023-12-02 10:51:28 +0100
commitfc50065325f8b88d6986f089ae103b5db858ab96 (patch)
tree9f8c80b4cd7b0ae4a3ff255b55e96f08f39c950b
parent9e9d673b2c84719937db5d6ab1d8cbcd7d45e974 (diff)
x86/callthunks: Correct calculation of dest address in is_callthunk()
GCC didn't warn on the invalid use of relocation destination pointer, so the calculated destination value was applied to the uninitialized pointer location in error. Fixes: 17bce3b2ae2d ("x86/callthunks: Handle %rip-relative relocations in call thunk template") Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Uros Bizjak <[email protected]> Signed-off-by: Ingo Molnar <[email protected]> Closes: https://lore.kernel.org/lkml/[email protected]/ Link: https://lore.kernel.org/r/[email protected]
-rw-r--r--arch/x86/kernel/callthunks.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/x86/kernel/callthunks.c b/arch/x86/kernel/callthunks.c
index f56fa303d643..2324c7f9a841 100644
--- a/arch/x86/kernel/callthunks.c
+++ b/arch/x86/kernel/callthunks.c
@@ -312,7 +312,7 @@ static bool is_callthunk(void *addr)
if (!thunks_initialized || skip_addr((void *)dest))
return false;
- *pad = dest - tmpl_size;
+ pad = (void *)(dest - tmpl_size);
memcpy(insn_buff, skl_call_thunk_template, tmpl_size);
apply_relocation(insn_buff, tmpl_size, pad,