arm64: bpf: fix endianness conversion bugs
authorXi Wang <xi.wang@gmail.com>
Fri, 26 Jun 2015 01:39:15 +0000 (18:39 -0700)
committerCatalin Marinas <catalin.marinas@arm.com>
Fri, 26 Jun 2015 13:15:39 +0000 (14:15 +0100)
commitd63903bbc30c7ccad040851dfdb4da12d9a17bcf
tree6ddc09f1a2289e833b51b373049649f416a586bf
parent8eee539ddea09bccae2426f09b0ba6a18b72b691
arm64: bpf: fix endianness conversion bugs

Upper bits should be zeroed in endianness conversion:

- even when there's no need to change endianness (i.e., BPF_FROM_BE
  on big endian or BPF_FROM_LE on little endian);

- after rev16.

This patch fixes such bugs by emitting extra instructions to clear
upper bits.

Cc: Zi Shen Lim <zlim.lnx@gmail.com>
Acked-by: Alexei Starovoitov <ast@plumgrid.com>
Fixes: e54bcde3d69d ("arm64: eBPF JIT compiler")
Cc: <stable@vger.kernel.org> # 3.18+
Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/net/bpf_jit.h
arch/arm64/net/bpf_jit_comp.c