diff options
author | Peter Zijlstra <peterz@infradead.org> | 2021-10-26 14:01:47 +0200 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2021-10-28 23:25:29 +0200 |
commit | dceba0817ca329868a15e2e1dd46eb6340b69206 (patch) | |
tree | db2c78fdc514cad884fa8f21a2ce7a1abd7b76b4 /kernel/locking | |
parent | x86,bugs: Unconditionally allow spectre_v2=retpoline,amd (diff) | |
download | linux-dceba0817ca329868a15e2e1dd46eb6340b69206.tar.xz linux-dceba0817ca329868a15e2e1dd46eb6340b69206.zip |
bpf,x86: Simplify computing label offsets
Take an idea from the 32bit JIT, which uses the multi-pass nature of
the JIT to compute the instruction offsets on a prior pass in order to
compute the relative jump offsets on a later pass.
Application to the x86_64 JIT is slightly more involved because the
offsets depend on program variables (such as callee_regs_used and
stack_depth) and hence the computed offsets need to be kept in the
context of the JIT.
This removes, IMO quite fragile, code that hard-codes the offsets and
tries to compute the length of variable parts of it.
Convert both emit_bpf_tail_call_*() functions which have an out: label
at the end. Additionally emit_bpt_tail_call_direct() also has a poke
table entry, for which it computes the offset from the end (and thus
already relies on the previous pass to have computed addrs[i]), also
convert this to be a forward based offset.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Reviewed-by: Borislav Petkov <bp@suse.de>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Josh Poimboeuf <jpoimboe@redhat.com>
Tested-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/r/20211026120310.552304864@infradead.org
Diffstat (limited to 'kernel/locking')
0 files changed, 0 insertions, 0 deletions