]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
x86/retpoline: Create a retpoline thunk array
authorPeter Zijlstra <peterz@infradead.org>
Tue, 26 Oct 2021 12:01:41 +0000 (14:01 +0200)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 13 Apr 2022 14:44:34 +0000 (16:44 +0200)
commita560975e59a668cb00d3729267ecfd5c462fd233
treecf2a2d977a660de136e5123d6f4061ee1c0af2e3
parent1bbe7f161f5b25788f425fbb35ee642c469f182b
x86/retpoline: Create a retpoline thunk array

BugLink: https://bugs.launchpad.net/bugs/1967579
Stick all the retpolines in a single symbol and have the individual
thunks as inner labels, this should guarantee thunk order and layout.

Previously there were 16 (or rather 15 without rsp) separate symbols and
a toolchain might reasonably expect it could displace them however it
liked, with disregard for their relative position.

However, now they're part of a larger symbol. Any change to their
relative position would disrupt this larger _array symbol and thus not
be sound.

This is the same reasoning used for data symbols. On their own there
is no guarantee about their relative position wrt to one aonther, but
we're still able to do arrays because an array as a whole is a single
larger symbol.

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20211026120310.169659320@infradead.org
(cherry picked from commit 1a6f74429c42a3854980359a758e222005712aee)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
arch/x86/include/asm/nospec-branch.h
arch/x86/lib/retpoline.S