ARM: net: bpf: fix LDX instructions
authorRussell King <rmk+kernel@armlinux.org.uk>
Sat, 13 Jan 2018 21:06:16 +0000 (21:06 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jan 2018 13:03:43 +0000 (14:03 +0100)
commit5911dd3f92aefd86b4a86286c94398681c453802
tree4caced539b0937c85c80fa1d42f5bf97bccd049b
parent0da4a4d0c7f941638e2e7e515c2d758de8976418
ARM: net: bpf: fix LDX instructions

commit ec19e02b343db991d2d1610c409efefebf4e2ca9 upstream.

When the source and destination register are identical, our JIT does not
generate correct code, which leads to kernel oopses.

Fix this by (a) generating more efficient code, and (b) making use of
the temporary earlier if we will overwrite the address register.

Fixes: 39c13c204bb1 ("arm: eBPF JIT compiler")
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm/net/bpf_jit_32.c