Commit c4aa454
bpf: support for void/primitive __arg_untrusted global func params
Allow specifying __arg_untrusted for void */char */int */long *
parameters. Treat such parameters as
PTR_TO_MEM|MEM_RDONLY|PTR_UNTRUSTED of size zero.
Intended usage is as follows:
int memcmp(char *a __arg_untrusted, char *b __arg_untrusted, size_t n) {
bpf_for(i, 0, n) {
if (a[i] - b[i]) // load at any offset is allowed
return a[i] - b[i];
}
return 0;
}
Allocate register id for ARG_PTR_TO_MEM parameters only when
PTR_MAYBE_NULL is set. Register id for PTR_TO_MEM is used only to
propagate non-null status after conditionals.
Suggested-by: Alexei Starovoitov <[email protected]>
Acked-by: Kumar Kartikeya Dwivedi <[email protected]>
Signed-off-by: Eduard Zingerman <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Alexei Starovoitov <[email protected]>1 parent 54ac2c9 commit c4aa454
3 files changed
+19
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
| 226 | + | |
226 | 227 | | |
227 | 228 | | |
228 | 229 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
891 | 891 | | |
892 | 892 | | |
893 | 893 | | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
894 | 900 | | |
895 | 901 | | |
896 | 902 | | |
| |||
7830 | 7836 | | |
7831 | 7837 | | |
7832 | 7838 | | |
| 7839 | + | |
| 7840 | + | |
| 7841 | + | |
| 7842 | + | |
| 7843 | + | |
| 7844 | + | |
| 7845 | + | |
7833 | 7846 | | |
7834 | 7847 | | |
7835 | 7848 | | |
| |||
7838 | 7851 | | |
7839 | 7852 | | |
7840 | 7853 | | |
7841 | | - | |
| 7854 | + | |
7842 | 7855 | | |
7843 | 7856 | | |
7844 | 7857 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23152 | 23152 | | |
23153 | 23153 | | |
23154 | 23154 | | |
23155 | | - | |
23156 | | - | |
| 23155 | + | |
| 23156 | + | |
23157 | 23157 | | |
23158 | 23158 | | |
23159 | | - | |
| 23159 | + | |
| 23160 | + | |
23160 | 23161 | | |
23161 | 23162 | | |
23162 | 23163 | | |
| |||
0 commit comments