On 08/26, Kuniyuki Iwashima wrote: > We will store a flag in sk->sk_memcg by bpf_setsockopt() during > socket() or before sk->sk_memcg is set in accept(). > > BPF_CGROUP_INET_SOCK_CREATE is invoked by __cgroup_bpf_run_filter_sk() > that passes a pointer to struct sock to the bpf prog as void *ctx. > > But there are no bpf_func_proto for bpf_setsockopt() that receives > the ctx as a pointer to struct sock. > > Let's add a new bpf_setsockopt() variant for BPF_CGROUP_INET_SOCK_CREATE. [..] > Note that inet_create() is not under lock_sock(). Does anything prevent us from grabbing the lock before running SOCK_CREATE progs? This is not the fast path, so should be ok? Will make it easier to reason about socket options (where all paths are locked). We do similar things for sock_addr progs in BPF_CGROUP_RUN_SA_PROG_LOCK.