Skip to content

Fix nil pointer dereference in Windows memory eviction threshold notifier#1

Open
rzlink wants to merge 23 commits intomasterfrom
fix/eviction-nil-deref-windows
Open

Fix nil pointer dereference in Windows memory eviction threshold notifier#1
rzlink wants to merge 23 commits intomasterfrom
fix/eviction-nil-deref-windows

Conversation

@rzlink
Copy link
Copy Markdown
Owner

@rzlink rzlink commented Apr 30, 2026

What this PR does

Fixes a nil pointer dereference bug in the Windows memory eviction threshold notifier.

Bug

In checkMemoryUsage() (memory_threshold_notifier_windows.go), when GetPerformanceInfo() fails, the error is logged but execution continues. The next line dereferences perfInfo (which is nil), causing a panic:

perfInfo, err := winstats.GetPerformanceInfo()
if err != nil {
    logger.Error(err, "...")
    // missing return — falls through to nil dereference below
}
commitLimitBytes := perfInfo.CommitLimitPages * perfInfo.PageSize  // PANIC

Fix

  1. Add early return after the error log to prevent the nil dereference.
  2. Fix typo in variable name: commmiLimitBytescommitLimitBytes (triple 'm').

Testing

This is a minimal, targeted fix. The nil dereference is evident from code inspection — GetPerformanceInfo() returns (*PerformanceInformation, error) and on error the pointer is nil.

pacoxu and others added 23 commits March 10, 2026 16:54
The methods Close for mockRuntimeService in CPUManager and MemoryManager
tests are not used and are not part of the `runtimeService interface`

They were added during improving of passing context to CRI client:
"CRI client: pass context to Close and use contextual logging",
but are not part of that feature.

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
Signed-off-by: Anish Ramasekar <anish.ramasekar@gmail.com>
This commit expands the validation test coverage for the +k8s:minimum tag:
- Adds short-circuit tests to verify nil pointer handling for optional and required pointers.
- Adds test coverage for changing from one invalid value to another different invalid value.
- Adds typedef test coverage for optional and required structs.
…rd stat failure

Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
…nager dir to recover it

Signed-off-by: Stanislav Láznička <slznika@microsoft.com>
…ndows too

Signed-off-by: Mark Rossetti <marosset@microsoft.com>
…p-coredns-1.14.3

Revert "bump coredns to v1.14.3"
Fix 1.36 changelog terminology for DRA Node Allocatable Resources
…ize_node_selectors_fg

Drop `AuthorizeNodeWithSelectors` and `AuthorizeWithSelectors` feature gates
…text-close

Remove unused Close methods of mockRuntimeService in kubelet tests
…nittest-fix

Fixing prune-junit-xml directory walking so labels get applied for Windows too
…Finalization

apiextensions-apiserver: forbid CR create/apply while CRD is deleting
…tigate

e2e node conformance: fix the EnsureCredentialPulledImages test flakes
Add tests for minimum with required and optional
…chval-case

feat(validation-gen): add eachVal + maxBytes validation for resource string values
…fier

When GetPerformanceInfo() fails, the error is logged but execution
continues, causing a nil pointer dereference on the next line when
accessing perfInfo.CommitLimitPages. Add an early return after the
error log to prevent the panic.

Also fix the typo in variable name: commmiLimitBytes -> commitLimitBytes.
@rzlink rzlink force-pushed the fix/eviction-nil-deref-windows branch from 9cbb1e2 to c957c96 Compare May 1, 2026 04:35
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.