diff --git a/tools/testing/selftests/bpf/progs/verifier_const.c b/tools/testing/selftests/bpf/progs/verifier_const.c index 5158dbea8c4318..2e533d7eec2f12 100644 --- a/tools/testing/selftests/bpf/progs/verifier_const.c +++ b/tools/testing/selftests/bpf/progs/verifier_const.c @@ -10,7 +10,7 @@ long bar; long bart = 96; SEC("tc/ingress") -__description("rodata: write rejected") +__description("rodata/strtol: write rejected") __failure __msg("write into map forbidden") int tcx1(struct __sk_buff *skb) { @@ -20,7 +20,7 @@ int tcx1(struct __sk_buff *skb) } SEC("tc/ingress") -__description("bss: write accepted") +__description("bss/strtol: write accepted") __success int tcx2(struct __sk_buff *skb) { @@ -30,7 +30,7 @@ int tcx2(struct __sk_buff *skb) } SEC("tc/ingress") -__description("data: write accepted") +__description("data/strtol: write accepted") __success int tcx3(struct __sk_buff *skb) { @@ -39,4 +39,31 @@ int tcx3(struct __sk_buff *skb) return TCX_PASS; } +SEC("tc/ingress") +__description("rodata/mtu: write rejected") +__failure __msg("write into map forbidden") +int tcx4(struct __sk_buff *skb) +{ + bpf_check_mtu(skb, skb->ifindex, (__u32 *)&foo, 0, 0); + return TCX_PASS; +} + +SEC("tc/ingress") +__description("bss/mtu: write accepted") +__success +int tcx5(struct __sk_buff *skb) +{ + bpf_check_mtu(skb, skb->ifindex, (__u32 *)&bar, 0, 0); + return TCX_PASS; +} + +SEC("tc/ingress") +__description("data/mtu: write accepted") +__success +int tcx6(struct __sk_buff *skb) +{ + bpf_check_mtu(skb, skb->ifindex, (__u32 *)&bart, 0, 0); + return TCX_PASS; +} + char LICENSE[] SEC("license") = "GPL";