On Wed, Jul 2, 2025 at 3:42 PM Eduard Zingerman <eddyz87@xxxxxxxxx> wrote: > > 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; > } ... > +bool btf_type_is_primitive(const struct btf_type *t) > +{ > + return (btf_type_is_int(t) && btf_type_int_is_regular(t)) || > + btf_is_any_enum(t); > +} Should array of primitive types be allowed as well ? Since in C 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]; will work just like 'char *'.