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 130f959 commit 87c97f6Copy full SHA for 87c97f6
tools/testing/selftests/bpf/progs/mem_rdonly_untrusted.c
@@ -205,4 +205,25 @@ int misaligned_access(void *ctx)
205
return combine(bpf_rdonly_cast(&global, 0) + 1);
206
}
207
208
+__weak int return_one(void)
209
+{
210
+ return 1;
211
+}
212
+
213
+SEC("socket")
214
+__success
215
+__retval(1)
216
+int null_check(void *ctx)
217
218
+ int *p;
219
220
+ p = bpf_rdonly_cast(0, 0);
221
+ if (p == 0)
222
+ /* make this a function call to avoid compiler
223
+ * moving r0 assignment before check.
224
+ */
225
+ return return_one();
226
+ return 0;
227
228
229
char _license[] SEC("license") = "GPL";
0 commit comments