We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d43029f commit 991e555Copy full SHA for 991e555
tools/testing/selftests/bpf/progs/verifier_sock.c
@@ -1096,6 +1096,20 @@ int invalidate_xdp_pkt_pointers_from_global_func(struct xdp_md *x)
1096
return XDP_PASS;
1097
}
1098
1099
+/* XDP packet changing kfunc calls invalidate packet pointers */
1100
+SEC("xdp")
1101
+__failure __msg("invalid mem access")
1102
+int invalidate_xdp_pkt_pointers(struct xdp_md *x)
1103
+{
1104
+ int *p = (void *)(long)x->data;
1105
+
1106
+ if ((void *)(p + 1) > (void *)(long)x->data_end)
1107
+ return XDP_DROP;
1108
+ bpf_xdp_pull_data(x, 0);
1109
+ *p = 42; /* this is unsafe */
1110
+ return XDP_PASS;
1111
+}
1112
1113
__noinline
1114
int tail_call(struct __sk_buff *sk)
1115
{
0 commit comments