diff options
author | Alexei Starovoitov <ast@fb.com> | 2016-05-19 18:17:14 -0700 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-05-20 19:53:03 -0400 |
commit | 1b9b69ecb3a5236d4d3da0f0fa11af916371841e (patch) | |
tree | 1f5773cda4c0b535c4432f12a633ff304d11a004 /drivers/sn/Kconfig | |
parent | d91b28ed42de99217efb2e8cb0357263d6fb737c (diff) | |
download | linux-1b9b69ecb3a5236d4d3da0f0fa11af916371841e.tar.bz2 |
bpf: teach verifier to recognize imm += ptr pattern
Humans don't write C code like:
u8 *ptr = skb->data;
int imm = 4;
imm += ptr;
but from llvm backend point of view 'imm' and 'ptr' are registers and
imm += ptr may be preferred vs ptr += imm depending which register value
will be used further in the code, while verifier can only recognize ptr += imm.
That caused small unrelated changes in the C code of the bpf program to
trigger rejection by the verifier. Therefore teach the verifier to recognize
both ptr += imm and imm += ptr.
For example:
when R6=pkt(id=0,off=0,r=62) R7=imm22
after r7 += r6 instruction
will be R6=pkt(id=0,off=0,r=62) R7=pkt(id=0,off=22,r=62)
Fixes: 969bf05eb3ce ("bpf: direct packet access")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/sn/Kconfig')
0 files changed, 0 insertions, 0 deletions