-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
policy: Fix potential nil pointer deref in selectorManager.GetSelections #27805
Merged
youngnick
merged 1 commit into
cilium:main
from
learnitall:pr/learnitall/fix-selectorcache-nil-deref
Sep 8, 2023
Merged
policy: Fix potential nil pointer deref in selectorManager.GetSelections #27805
youngnick
merged 1 commit into
cilium:main
from
learnitall:pr/learnitall/fix-selectorcache-nil-deref
Sep 8, 2023
Conversation
This file contains 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
maintainer-s-little-helper
bot
added
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Aug 29, 2023
learnitall
added
the
release-note/misc
This PR makes changes that have no direct user impact.
label
Aug 29, 2023
maintainer-s-little-helper
bot
removed
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Aug 29, 2023
learnitall
added
kind/bug
This is a bug in the Cilium logic.
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
labels
Aug 29, 2023
maintainer-s-little-helper
bot
removed
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
labels
Aug 29, 2023
learnitall
added
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
affects/v1.12
This issue affects v1.12 branch
affects/v1.13
This issue affects v1.13 branch
affects/v1.14
This issue affects v1.14 branch
labels
Aug 29, 2023
maintainer-s-little-helper
bot
removed
the
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
label
Aug 29, 2023
learnitall
added
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
needs-backport/1.12
needs-backport/1.13
This PR / issue needs backporting to the v1.13 branch
needs-backport/1.14
This PR / issue needs backporting to the v1.14 branch
and removed
dont-merge/needs-release-note-label
The author needs to describe the release impact of these changes.
labels
Aug 29, 2023
learnitall
force-pushed
the
pr/learnitall/fix-selectorcache-nil-deref
branch
from
August 29, 2023 22:36
6d5b5c8
to
d58943c
Compare
learnitall
force-pushed
the
pr/learnitall/fix-selectorcache-nil-deref
branch
from
August 30, 2023 14:42
d58943c
to
6c9a536
Compare
aditighag
approved these changes
Aug 31, 2023
/test |
This commit address the case in which `selectorManager.GetSelections` is called before `selectorManager.updateSelections` is called, which can cause a panic due to a nil pointer dereference in case the internal `selectorManager.selections` field is nil. To address this case, if the `selectorManager` has a nil value for its internal field `selections`, then `emptySelection` is returned. The reason `GetSelections` cannot modify the internal `selections` field if it sees that it is nil is because `selectorManager.setSelections` requires the managing `SelectorCache.mutex` to be locked. This cannot be guaranteed inside a call to `selectorManager.GetSelections`, which does not require locking. Signed-off-by: Ryan Drew <ryan.drew@isovalent.com>
learnitall
force-pushed
the
pr/learnitall/fix-selectorcache-nil-deref
branch
from
September 7, 2023 16:00
6c9a536
to
364130c
Compare
/test |
maintainer-s-little-helper
bot
added
the
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
label
Sep 7, 2023
gandro
added
backport-pending/1.14
The backport for Cilium 1.14.x for this PR is in progress.
and removed
needs-backport/1.14
This PR / issue needs backporting to the v1.14 branch
labels
Sep 12, 2023
gandro
added
backport-pending/1.13
The backport for Cilium 1.13.x for this PR is in progress.
and removed
needs-backport/1.13
This PR / issue needs backporting to the v1.13 branch
labels
Sep 12, 2023
julianwiedmann
added
backport-done/1.13
The backport for Cilium 1.13.x for this PR is done.
backport-done/1.12
The backport for Cilium 1.12.x for this PR is done.
and removed
backport-pending/1.13
The backport for Cilium 1.13.x for this PR is in progress.
backport-pending/1.12
labels
Sep 14, 2023
gandro
added
backport-done/1.14
The backport for Cilium 1.14.x for this PR is done.
and removed
backport-pending/1.14
The backport for Cilium 1.14.x for this PR is in progress.
labels
Sep 25, 2023
jrajahalme
moved this from Needs backport from main
to Backport done to v1.13
in 1.13.8
Oct 17, 2023
This was referenced Oct 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects/v1.12
This issue affects v1.12 branch
affects/v1.13
This issue affects v1.13 branch
affects/v1.14
This issue affects v1.14 branch
backport-done/1.12
The backport for Cilium 1.12.x for this PR is done.
backport-done/1.13
The backport for Cilium 1.13.x for this PR is done.
backport-done/1.14
The backport for Cilium 1.14.x for this PR is done.
kind/bug
This is a bug in the Cilium logic.
ready-to-merge
This PR has passed all tests and received consensus from code owners to merge.
release-note/misc
This PR makes changes that have no direct user impact.
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.
Please ensure your pull request adheres to the following guidelines:
description and a
Fixes: #XXX
line if the commit addresses a particularGitHub issue.
Fixes: <commit-id>
tag, thenplease add the commit author[s] as reviewer[s] to this issue.
This commit address the case in which
selectorManager.GetSelections
is called beforeselectorManager.updateSelections
is called, which can cause a panic due to a nil pointer dereference in case the internalselectorManager.selections
field is nil. To address this case, if theselectorManager
has a nil value for its internal fieldselections
, thenemptySelection
is returned.The reason
GetSelections
cannot modify the internalselections
field if it sees that it is nil is becauseselectorManager.setSelections
requires the managingSelectorCache.mutex
to be locked. This cannot be guaranteed inside a call toselectorManager.GetSelections
, which does not require locking.This needs to be backported to 1.14, 1.1,3 and 1.12, please. Versions 1.13 and 1.12 will have a merge conflict due to changes made in commit 9397655, which adjusted how the atomic pointer is loaded. The needed change for these versions should look something like this: