As suggested by Maciej Żenczykowski in [1], extend try_match_pkt_pointers to allow verification of BPF, generated for C code like below: if (data + 42 != data_end) { ... } Also simplify try_match_pkt_pointers to avoid checking both 'pkt <op> pkt_end' and 'pkt_end <op> pkt' conditions, as suggested by Andrii Nakryiko. [1] https://lore.kernel.org/bpf/CAHo-Oow5V2u4ZYvzuR8NmJmFDPNYp0pQDJX66rZqUjFHvhx82A@xxxxxxxxxxxxxx/ Eduard Zingerman (3): bpf: simplify try_match_pkt_pointers() bpf: infer packet range for 'if pkt ==/!= pkt_end' comparisons selftests/bpf: test packet range inference for 'if pkt ==/!= pkt_end' kernel/bpf/verifier.c | 112 ++++---------- .../bpf/progs/verifier_direct_packet_access.c | 138 ++++++++++++++++++ 2 files changed, 170 insertions(+), 80 deletions(-) -- 2.43.0