static_call: Fix the module key fixup
authorPeter Zijlstra <peterz@infradead.org>
Thu, 25 Feb 2021 22:03:51 +0000 (23:03 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 30 Mar 2021 12:31:53 +0000 (14:31 +0200)
commit0fefb5f3e5742cac36bcaea1be06c577e22fb6f7
treefe783e0b6aab528cb498403859c20b0b0dbcb960
parenta63068e93917927d443e32609dde9298bcd14833
static_call: Fix the module key fixup

[ Upstream commit 50bf8080a94d171e843fc013abec19d8ab9f50ae ]

Provided the target address of a R_X86_64_PC32 relocation is aligned,
the low two bits should be invariant between the relative and absolute
value.

Turns out the address is not aligned and things go sideways, ensure we
transfer the bits in the absolute form when fixing up the key address.

Fixes: 73f44fe19d35 ("static_call: Allow module use without exposing static_call_key")
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Tested-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Link: https://lkml.kernel.org/r/20210225220351.GE4746@worktop.programming.kicks-ass.net
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/static_call.c