]> git.baikalelectronics.ru Git - kernel.git/commit
s390/bpf: Tolerate not converging code shrinking
authorIlya Leoshkevich <iii@linux.ibm.com>
Fri, 17 Jul 2020 16:53:25 +0000 (18:53 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 21 Jul 2020 20:26:25 +0000 (13:26 -0700)
commit24712b224758f5389e8f4c70f9f552f7ef054c72
treefcef3f57edcb12923456221bdbdb6532a589368d
parent1209fe5ba0b2d9d7af8de2390156d9c93f7d5341
s390/bpf: Tolerate not converging code shrinking

"BPF_MAXINSNS: Maximum possible literals" unnecessarily falls back to
the interpreter because of failing sanity check in bpf_set_addr. The
problem is that there are a lot of branches that can be shrunk, and
doing so opens up the possibility to shrink even more. This process
does not converge after 3 passes, causing code offsets to change during
the codegen pass, which must never happen.

Fix by inserting nops during codegen pass in order to preserve code
offets.

Fixes: 1a1adbc6981e ("s390/bpf: Use relative long branches")
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200717165326.6786-5-iii@linux.ibm.com
arch/s390/net/bpf_jit_comp.c