diff options
author | Ilya Leoshkevich <iii@linux.ibm.com> | 2020-09-10 01:21:41 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-09-14 18:21:31 -0700 |
commit | d72714c1da138e6755d3bd14662dc5b7f17fae7f (patch) | |
tree | 2189c79bb786aa66f50823217cdc9c3e91b392fd /samples | |
parent | 2bab48c5bef00d103085da71a01da27ec7200c08 (diff) |
s390/bpf: Fix multiple tail calls
In order to branch around tail calls (due to out-of-bounds index,
exceeding tail call count or missing tail call target), JIT uses
label[0] field, which contains the address of the instruction following
the tail call. When there are multiple tail calls, label[0] value comes
from handling of a previous tail call, which is incorrect.
Fix by getting rid of label array and resolving the label address
locally: for all 3 branches that jump to it, emit 0 offsets at the
beginning, and then backpatch them with the correct value.
Also, do not use the long jump infrastructure: the tail call sequence
is known to be short, so make all 3 jumps short.
Fixes: 6651ee070b31 ("s390/bpf: implement bpf_tail_call() helper")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200909232141.3099367-1-iii@linux.ibm.com
Diffstat (limited to 'samples')
0 files changed, 0 insertions, 0 deletions