bpf, x64: use %rcx instead of %rax for tail call retpolines
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Wed, 16 Sep 2020 21:10:04 +0000 (23:10 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 17 Sep 2020 19:59:31 +0000 (12:59 -0700)
commit0d4ddce300bd9031a36b55451045d505ebf7cae2
tree22311eed321b0c57a13b7a809218af47ef6216ea
parentc64779e24e88a9915b2f35fbb9851ef2c5462cc2
bpf, x64: use %rcx instead of %rax for tail call retpolines

Currently, %rax is used to store the jump target when BPF program is
emitting the retpoline instructions that are handling the indirect
tailcall.

There is a plan to use %rax for different purpose, which is storing the
tail call counter. In order to preserve this value across the tailcalls,
adjust the BPF indirect tailcalls so that the target program will reside
in %rcx and teach the retpoline instructions about new location of jump
target.

Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/x86/include/asm/nospec-branch.h
arch/x86/net/bpf_jit_comp.c