Skip to content
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

remove the risk of file descriptor reuse from arping #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JacobTanenbaum
Copy link

@JacobTanenbaum JacobTanenbaum commented Feb 1, 2024

using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will be taken care of by the goroutine upon its return

JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes that referenced this pull request Feb 1, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

Additionally removing the timeout from the select case because that will/cannot work as intended. In linux close() does not
cause system calls using the socket to return. This contributes to the file descriptor reuse issue mentioned above and with
the defered sock.deinitialize() can lead to double closing the socket.
'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes that referenced this pull request Feb 1, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

Additionally removing the timeout from the select case because that will/cannot work as intended. In linux close() does not
cause system calls using the socket to return. This contributes to the file descriptor reuse issue mentioned above and with
the defered sock.deinitialize() can lead to double closing the socket.
'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes that referenced this pull request Feb 2, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
using sock.deinitialize() outside of the goroutine that is using the
socket leaves the potential for erroneous and unexpected behavior. When
calling Ping() very quickly the socket fd can be reused while a
goroutine is still trying to read from it and cause the goroutine to
deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes that referenced this pull request Feb 9, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes that referenced this pull request Feb 9, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
jcaamano pushed a commit to ovn-kubernetes/ovn-kubernetes that referenced this pull request Feb 9, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
@openshift-merge-robot
Copy link

Fix included in accepted release 4.16.0-0.nightly-2024-02-17-013806

JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes-1 that referenced this pull request Apr 1, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
JacobTanenbaum added a commit to JacobTanenbaum/ovn-kubernetes-1 that referenced this pull request May 15, 2024
here is the PR for the upstream version j-keck/arping#17

'
using sock.deinitialize() outside of the goroutine that is using the socket leaves the potential for erroneous and
unexpected behavior. When calling Ping() very quickly the socket fd can be reused while a goroutine is still trying to read
from it and cause the goroutine to deadlock.

removing the sock.deinitialize() from the timeout select case as it will
be taken care of by the goroutine upon its return'

Signed-off-by: Jacob Tanenbaum <jtanenba@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants