On Mon, Sep 5, 2022 at 6:14 AM Lorenzo Bianconi <lorenzo@xxxxxxxxxx> wrote: > +int bpf_ct_set_nat_info(struct nf_conn___init *nfct__ref, > + union nf_inet_addr *addr, __be16 *port, > + enum nf_nat_manip_type manip) > +{ ... > @@ -437,6 +483,7 @@ BTF_ID_FLAGS(func, bpf_ct_set_timeout, KF_TRUSTED_ARGS) > BTF_ID_FLAGS(func, bpf_ct_change_timeout, KF_TRUSTED_ARGS) > BTF_ID_FLAGS(func, bpf_ct_set_status, KF_TRUSTED_ARGS) > BTF_ID_FLAGS(func, bpf_ct_change_status, KF_TRUSTED_ARGS) > +BTF_ID_FLAGS(func, bpf_ct_set_nat_info) > BTF_SET8_END(nf_ct_kfunc_set) Instead of __ref and patch 1 and 2 it would be better to change the meaning of "trusted_args". In this case "addr" and "port" are just as "trusted". They're not refcounted per verifier definition, but they need to be "trusted" by the helper. At the end the "trusted_args" flags would mean "this helper can assume that all pointers can be safely accessed without worrying about lifetime".