Skip to content

remove the risk of file descriptor reuse from arping#17

Open
JacobTanenbaum wants to merge 1 commit intoj-keck:masterfrom
JacobTanenbaum:threading
Open

remove the risk of file descriptor reuse from arping#17
JacobTanenbaum wants to merge 1 commit intoj-keck:masterfrom
JacobTanenbaum:threading

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 JacobTanenbaum force-pushed the threading branch 2 times, most recently from 4e0d3e8 to 71d47a2 Compare February 2, 2024 19:52
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