diff options
author | Xi Wang <xi.wang@gmail.com> | 2015-06-26 04:39:15 +0300 |
---|---|---|
committer | Catalin Marinas <catalin.marinas@arm.com> | 2015-06-26 16:15:39 +0300 |
commit | d63903bbc30c7ccad040851dfdb4da12d9a17bcf (patch) | |
tree | 6ddc09f1a2289e833b51b373049649f416a586bf /arch/arm64/net/bpf_jit.h | |
parent | 8eee539ddea09bccae2426f09b0ba6a18b72b691 (diff) | |
download | linux-d63903bbc30c7ccad040851dfdb4da12d9a17bcf.tar.xz |
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>
Diffstat (limited to 'arch/arm64/net/bpf_jit.h')
-rw-r--r-- | arch/arm64/net/bpf_jit.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/arch/arm64/net/bpf_jit.h b/arch/arm64/net/bpf_jit.h index de0a81a539a0..98a26ce82d26 100644 --- a/arch/arm64/net/bpf_jit.h +++ b/arch/arm64/net/bpf_jit.h @@ -110,6 +110,10 @@ /* Rd = Rn >> shift; signed */ #define A64_ASR(sf, Rd, Rn, shift) A64_SBFM(sf, Rd, Rn, shift, (sf) ? 63 : 31) +/* Zero extend */ +#define A64_UXTH(sf, Rd, Rn) A64_UBFM(sf, Rd, Rn, 0, 15) +#define A64_UXTW(sf, Rd, Rn) A64_UBFM(sf, Rd, Rn, 0, 31) + /* Move wide (immediate) */ #define A64_MOVEW(sf, Rd, imm16, shift, type) \ aarch64_insn_gen_movewide(Rd, imm16, shift, \ |