Re: [Patch bpf-next v2 2/9] sock: introduce sk_prot->update_proto()
flat view
From: Cong Wang <hidden>
Date: 2021-03-04 23:52:16
Also in:
bpf
On Tue, Mar 2, 2021 at 10:23 AM Cong Wang [off-list ref] wrote:
On Tue, Mar 2, 2021 at 8:22 AM Lorenz Bauer [off-list ref] wrote:quoted
On Tue, 2 Mar 2021 at 02:37, Cong Wang [off-list ref] wrote: ...quoted
static inline void sk_psock_restore_proto(struct sock *sk, struct sk_psock *psock) { sk->sk_prot->unhash = psock->saved_unhash;Not related to your patch set, but why do an extra restore of sk_prot->unhash here? At this point sk->sk_prot is one of our tcp_bpf / udp_bpf protos, so overwriting that seems wrong?Good catch. It seems you are right, but I need a double check. And yes, it is completely unrelated to my patch, as the current code has the same problem.
Looking at this again. I noticed
commit 4da6a196f93b1af7612340e8c1ad8ce71e18f955
Author: John Fastabend [off-list ref]
Date: Sat Jan 11 06:11:59 2020 +0000
bpf: Sockmap/tls, during free we may call tcp_bpf_unhash() in loop
intentionally fixed a bug in kTLS with overwriting this ->unhash.
I agree with you that it should not be updated for sockmap case,
however I don't know what to do with kTLS case, it seems the bug the
above commit fixed still exists if we just revert it.
Anyway, this should be targeted for -bpf as a bug fix, so it does not
belong to this patchset.
Thanks.