]> git.baikalelectronics.ru Git - kernel.git/commit
s390/bpf: Fix optimizing out zero-extensions
authorIlya Leoshkevich <iii@linux.ibm.com>
Mon, 6 Sep 2021 13:04:14 +0000 (15:04 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Thu, 16 Sep 2021 08:39:55 +0000 (10:39 +0200)
commit0872824f9aea507f3ccfaca88f641999ef3d4340
tree566fa68b630035ccc491a6aa3ce8fba3366ee31b
parent553e98639fc77935631c6748d90a6cb98e34d541
s390/bpf: Fix optimizing out zero-extensions

Currently the JIT completely removes things like `reg32 += 0`,
however, the BPF_ALU semantics requires the target register to be
zero-extended in such cases.

Fix by optimizing out only the arithmetic operation, but not the
subsequent zero-extension.

Reported-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Fixes: 9f7ede77bdb9 ("s390/bpf: Add s390x eBPF JIT compiler backend")
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/net/bpf_jit_comp.c