bpf: add couple of test cases for signed extended imms
authorDaniel Borkmann <daniel@iogearbox.net>
Sat, 20 Jan 2018 00:24:31 +0000 (01:24 +0100)
committerAlexei Starovoitov <ast@kernel.org>
Sat, 20 Jan 2018 02:36:59 +0000 (18:36 -0800)
commitfcd1c9177195489c40198d2769649439dd88505b
treee5a90dbd92ed6ef04729bf5ddc180d272c5f75b5
parent205c380778d09291668da5267057a80385f89437
bpf: add couple of test cases for signed extended imms

Add a couple of test cases for interpreter and JIT that are
related to an issue we faced some time ago in Cilium [1],
which is fixed in LLVM with commit e53750e1e086 ("bpf: fix
bug on silently truncating 64-bit immediate").

Test cases were run-time checking kernel to behave as intended
which should also provide some guidance for current or new
JITs in case they should trip over this. Added for cBPF and
eBPF.

  [1] https://github.com/cilium/cilium/pull/2162

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
lib/test_bpf.c