-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net: bpf: handle return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND() #2339
Conversation
Master branch: ecf45e6 |
Master branch: f60edf5 |
15d4d15
to
d03557e
Compare
Master branch: 5b3d729 |
d03557e
to
6a00ec7
Compare
Master branch: b645941 |
6a00ec7
to
fec6ec3
Compare
Master branch: 3ccdcee |
The return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND() in __inet_bind() is not handled properly. While the return value is non-zero, it will set inet_saddr and inet_rcv_saddr to 0 and exit: err = BPF_CGROUP_RUN_PROG_INET4_POST_BIND(sk); if (err) { inet->inet_saddr = inet->inet_rcv_saddr = 0; goto out_release_sock; } Let's take UDP for example and see what will happen. For UDP socket, it will be added to 'udp_prot.h.udp_table->hash' and 'udp_prot.h.udp_table->hash2' after the sk->sk_prot->get_port() called success. If 'inet->inet_rcv_saddr' is specified here, then 'sk' will be in the 'hslot2' of 'hash2' that it don't belong to (because inet_saddr is changed to 0), and UDP packet received will not be passed to this sock. If 'inet->inet_rcv_saddr' is not specified here, the sock will work fine, as it can receive packet properly, which is wired, as the 'bind()' is already failed. I'm not sure what should do here, maybe we should unhash the sock for UDP? Therefor, user can try to bind another port? Signed-off-by: Menglong Dong <imagedong@tencent.com>
fec6ec3
to
0e17c94
Compare
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=601424 expired. Closing PR. |
Pull request for series with
subject: net: bpf: handle return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND()
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=601424