Skip to content

lb: fix panic in orphan backend cleanup when addr is zero-value#44853

Merged
dylandreimerink merged 1 commit intocilium:mainfrom
vipul-21:singhvipul/fix-lb
Mar 25, 2026
Merged

lb: fix panic in orphan backend cleanup when addr is zero-value#44853
dylandreimerink merged 1 commit intocilium:mainfrom
vipul-21:singhvipul/fix-lb

Conversation

@vipul-21
Copy link
Copy Markdown
Contributor

@vipul-21 vipul-21 commented Mar 18, 2026

When a BPF map write fails (E2BIG) during service reconciliation, updateReferences is never called, leaving backendReferences stale. If a backend is later released as an orphan and then re-added, updateBackendRevision creates a new backendStates entry but did not set the addr field — leaving it as a zero-value L3n4Addr.

On the next reconciliation, orphanBackends returns this entry and the agent calls orphanState.addr.IsIPv6() on the zero-value address, which panics with a nil pointer dereference.

Fix this by setting s.addr = addr in updateBackendRevision so that backendStates entries always have a valid address regardless of whether updateReferences runs.

Fixes: #44852

lb: fix panic in orphan backend cleanup when addr is zero-value

@maintainer-s-little-helper 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 Mar 18, 2026
@vipul-21 vipul-21 force-pushed the singhvipul/fix-lb branch 2 times, most recently from fe0fcd6 to ecab524 Compare March 18, 2026 02:44
When a BPF map write fails (E2BIG) during service reconciliation,
updateReferences is never called, leaving backendReferences stale.
If a backend is later released as an orphan and then re-added,
updateBackendRevision creates a new backendStates entry but did not
set the addr field — leaving it as a zero-value L3n4Addr.

On the next reconciliation, orphanBackends returns this entry and
the agent calls orphanState.addr.IsIPv6() on the zero-value address,
which panics with a nil pointer dereference.

Fix this by setting s.addr = addr in updateBackendRevision so that
backendStates entries always have a valid address regardless of
whether updateReferences runs.

Fixes: cilium#44852

Signed-off-by: Vipul Singh <singhvipul@microsoft.com>
@vipul-21 vipul-21 force-pushed the singhvipul/fix-lb branch from ecab524 to 1f2f996 Compare March 20, 2026 21:57
@vipul-21 vipul-21 marked this pull request as ready for review March 20, 2026 22:21
@vipul-21 vipul-21 requested a review from a team as a code owner March 20, 2026 22:21
@vipul-21
Copy link
Copy Markdown
Contributor Author

/test

@dylandreimerink dylandreimerink added release-note/bug This PR fixes an issue in a previous release of Cilium. needs-backport/1.19 This PR / issue needs backporting to the v1.19 branch labels Mar 25, 2026
@maintainer-s-little-helper maintainer-s-little-helper bot added ready-to-merge This PR has passed all tests and received consensus from code owners to merge. and removed dont-merge/needs-release-note-label The author needs to describe the release impact of these changes. labels Mar 25, 2026
@dylandreimerink dylandreimerink added this pull request to the merge queue Mar 25, 2026
Merged via the queue into cilium:main with commit baf56f2 Mar 25, 2026
83 checks passed
@tklauser tklauser mentioned this pull request Mar 25, 2026
5 tasks
@tklauser tklauser added backport-pending/1.19 The backport for Cilium 1.19.x for this PR is in progress. and removed needs-backport/1.19 This PR / issue needs backporting to the v1.19 branch labels Mar 25, 2026
@vipul-21
Copy link
Copy Markdown
Contributor Author

@tklauser we should backport this to v1.18 as well ?

@tklauser tklauser added the needs-backport/1.18 This PR / issue needs backporting to the v1.18 branch label Mar 25, 2026
@github-actions github-actions bot added backport-done/1.19 The backport for Cilium 1.19.x for this PR is done. and removed backport-pending/1.19 The backport for Cilium 1.19.x for this PR is in progress. labels Mar 25, 2026
@viktor-kurchenko viktor-kurchenko added backport-pending/1.18 The backport for Cilium 1.18.x for this PR is in progress. and removed needs-backport/1.18 This PR / issue needs backporting to the v1.18 branch labels Mar 30, 2026
@github-actions github-actions bot added backport-done/1.18 The backport for Cilium 1.18.x for this PR is done. and removed backport-pending/1.18 The backport for Cilium 1.18.x for this PR is in progress. labels Apr 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-done/1.18 The backport for Cilium 1.18.x for this PR is done. backport-done/1.19 The backport for Cilium 1.19.x for this PR is done. ready-to-merge This PR has passed all tests and received consensus from code owners to merge. release-note/bug This PR fixes an issue in a previous release of Cilium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

LB BPF reconciler panics on zero-value backend address after map-full failure

4 participants