net: bpf: handle return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND()#2339
Closed
kernel-patches-bot wants to merge 2 commits intobpf-nextfrom
Closed
net: bpf: handle return value of BPF_CGROUP_RUN_PROG_INET4_POST_BIND()#2339kernel-patches-bot wants to merge 2 commits intobpf-nextfrom
kernel-patches-bot wants to merge 2 commits intobpf-nextfrom
Conversation
Author
|
Master branch: ecf45e6 |
Author
|
Master branch: f60edf5 |
15d4d15 to
d03557e
Compare
Author
|
Master branch: 5b3d729 |
d03557e to
6a00ec7
Compare
Author
|
Master branch: b645941 |
6a00ec7 to
fec6ec3
Compare
Author
|
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
Author
|
At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=601424 expired. Closing PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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