Skip to content

Commit fc50065

Browse files
ubizjakIngo Molnar
authored andcommitted
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: 17bce3b ("x86/callthunks: Handle %rip-relative relocations in call thunk template") Reported-by: Nathan Chancellor <nathan@kernel.org> Signed-off-by: Uros Bizjak <ubizjak@gmail.com> Signed-off-by: Ingo Molnar <mingo@kernel.org> Closes: https://lore.kernel.org/lkml/20231201035457.GA321497@dev-arch.thelio-3990X/ Link: https://lore.kernel.org/r/20231201085727.3647051-1-ubizjak@gmail.com
1 parent 9e9d673 commit fc50065

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/x86/kernel/callthunks.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static bool is_callthunk(void *addr)
312312
if (!thunks_initialized || skip_addr((void *)dest))
313313
return false;
314314

315-
*pad = dest - tmpl_size;
315+
pad = (void *)(dest - tmpl_size);
316316

317317
memcpy(insn_buff, skl_call_thunk_template, tmpl_size);
318318
apply_relocation(insn_buff, tmpl_size, pad,

0 commit comments

Comments
 (0)