Repository navigation
Fix uninitialised LOCALLOCK read in lock unit test - #2196
Merged
Merged
Conversation
Member
Author
|
We found this issue in #1940. |
1 of 13 tasks
leborchuk
approved these changes
Nov 10, 2026
Alena0704
force-pushed
the
fix-lock-test-uninit-read
branch
from
November 16, 2026 11:13
91336d1 to
c4c3004
Compare
test__RemoveLocalLock_Null inserts a LOCALLOCK with hash_search(), which sets only the key, then sets lockOwners to NULL and calls RemoveLocalLock(). That also reads numLockOwners, to walk lockOwners, and holdsStrongLockCount, and both are uninitialised. The test passes as long as the memory happens to be zero; with glibc's MALLOC_PERTURB_ set, as meson test sets it, numLockOwners is garbage and the loop dereferences the NULL array. Clear the entry past its key, as LockAcquireExtended() does for a new one. Assisted-by: Claude Code
tuhaihe
force-pushed
the
fix-lock-test-uninit-read
branch
from
November 21, 2026 09:20
c4c3004 to
4e896b8
Compare
tuhaihe
enabled auto-merge (rebase)
November 21, 2026 10:14
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
test__RemoveLocalLock_Nullinserts a LOCALLOCK withhash_search(), which sets only the key, then sets lockOwners to NULL and callsRemoveLocalLock(). That also reads numLockOwners, to walk lockOwners, and holdsStrongLockCount, and both are uninitialised. The test passes as long as the memory happens to be zero; with glibc'sMALLOC_PERTURB_ set, as meson test sets it, numLockOwners is garbage and the loop dereferences the NULL array.Clear the entry past its key, as
LockAcquireExtended()does for a new one.Assisted-by: Claude Code
Fixes #ISSUE_Number
What does this PR do?
Type of Change
Breaking Changes
Test Plan
make installcheckmake -C src/test installcheck-cbdb-parallelImpact
Performance:
User-facing changes:
Dependencies:
Checklist
Additional Context
CI Skip Instructions