]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: let verifier to calculate and record max_pkt_offset
authorJiong Wang <jiong.wang@netronome.com>
Thu, 8 Nov 2018 09:08:42 +0000 (04:08 -0500)
committerDaniel Borkmann <daniel@iogearbox.net>
Fri, 9 Nov 2018 08:16:31 +0000 (09:16 +0100)
commit7327b7a2fd69e25db4fa080c07c5e5edc9905fb6
tree3f5c73cd81f673cacdd375e1e3f5381b5ce1c296
parent4ea0827fa39da73d9ad1ccc447321c14ad6320e7
bpf: let verifier to calculate and record max_pkt_offset

In check_packet_access, update max_pkt_offset after the offset has passed
__check_packet_access.

It should be safe to use u32 for max_pkt_offset as explained in code
comment.

Also, when there is tail call, the max_pkt_offset of the called program is
unknown, so conservatively set max_pkt_offset to MAX_PACKET_OFF for such
case.

Reviewed-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
include/linux/bpf.h
kernel/bpf/verifier.c