On Thu, Jul 09, 2020 at 10:07:59PM +0200, Daniel Borkmann wrote: > On 7/9/20 8:11 AM, Martin KaFai Lau wrote: > > It makes little sense for copying sk_user_data of reuseport_array during > > sk_clone_lock(). This patch reuses the SK_USER_DATA_NOCOPY bit introduced in > > commit f1ff5ce2cd5e ("net, sk_msg: Clear sk_user_data pointer on clone if tagged"). > > It is used to mark the sk_user_data is not supposed to be copied to its clone. > > > > Although the cloned sk's sk_user_data will not be used/freed in > > bpf_sk_reuseport_detach(), this change can still allow the cloned > > sk's sk_user_data to be used by some other means. > > > > Freeing the reuseport_array's sk_user_data does not require a rcu grace > > period. Thus, the existing rcu_assign_sk_user_data_nocopy() is not > > used. > > nit: Would have been nice though to add a nonrcu API for this nevertheless > instead of open coding. Agreed. I will create a follow-up patch to bpf-next later. I had created (READ|WRITE)_ONCE_SK_USER_DATA() earlier but then noticed there is no use on the READ_ONCE in that particular call, so ditched the idea. I think it does not matter much and should just use READ_ONCE also.