]> git.baikalelectronics.ru Git - kernel.git/commit
test_bpf: Add test to make conditional jump cross a large number of insns.
authorDavid Daney <david.daney@cavium.com>
Tue, 13 Jun 2017 23:49:36 +0000 (16:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Jun 2017 19:03:22 +0000 (15:03 -0400)
commit4d6f5e40dafdf818b49a9c3a564849781b1f5adc
treeeaeff2121d53c4cafcb35c2227e9ee34ae6f9301
parent8badf55579323df1c2dbb784a429a5bce2863d3a
test_bpf: Add test to make conditional jump cross a large number of insns.

On MIPS, conditional branches can only span 32k instructions.  To
exceed this limit in the JIT with the BPF maximum of 4k insns, we need
to choose eBPF insns that expand to more than 8 machine instructions.
Use BPF_LD_ABS as it is quite complex.  This forces the JIT to invert
the sense of the branch to branch around a long jump to the end.

This (somewhat) verifies that the branch inversion logic and target
address calculation of the long jumps are done correctly.

Signed-off-by: David Daney <david.daney@cavium.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
lib/test_bpf.c