Repository navigation
Fix misaligned xl_xact_distrib read in ParseCommitRecord - #2203
Merged
Merged
Conversation
yjhjstz
enabled auto-merge (rebase)
October 29, 2026 20:56
yjhjstz
force-pushed
the
fix-ubsan-xactdesc-distrib-alignment
branch
from
October 29, 2026 20:56
1b885f7 to
5724382
Compare
tuhaihe
force-pushed
the
fix-ubsan-xactdesc-distrib-alignment
branch
from
October 30, 2026 11:48
5724382 to
6325655
Compare
UBSan reported a misaligned member access when decoding the distributed-transaction field of commit WAL records during crash-recovery redo. The WAL record payload has no alignment guarantee; the neighboring xl_origin branch already copies onto the stack for exactly this reason. Do the same for xl_xact_distrib. Sanitizer report (UBSan, instrumented build, crash recovery): xactdesc.c:155:34: runtime error: member access within misaligned address 0x7b39d104de44 for type 'struct xl_xact_distrib', which requires 8 byte alignment #0 ParseCommitRecord xactdesc.c:155 #1 xact_redo xactdesc.c:... #2 ApplyWalRecord xlogrecovery.c:2023 #3 PerformWalRecovery xlogrecovery.c:1845 Undefined behavior at recovery time; harmless on x86_64 but incorrect on strictly aligned targets.
tuhaihe
force-pushed
the
fix-ubsan-xactdesc-distrib-alignment
branch
from
October 31, 2026 01:31
6325655 to
3e785b3
Compare
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.
UBSan reported a misaligned member access when decoding the distributed-transaction field of commit WAL records during crash-recovery redo. The WAL record payload has no alignment guarantee; the neighboring xl_origin branch already copies onto the stack for exactly this reason. Do the same for xl_xact_distrib.
Sanitizer report (UBSan, instrumented build, crash recovery):
xactdesc.c:155:34: runtime error: member access within misaligned
address 0x7b39d104de44 for type 'struct xl_xact_distrib', which
requires 8 byte alignment
#0 ParseCommitRecord xactdesc.c:155
#1 xact_redo xactdesc.c:...
#2 ApplyWalRecord xlogrecovery.c:2023
#3 PerformWalRecovery xlogrecovery.c:1845
Undefined behavior at recovery time; harmless on x86_64 but incorrect on strictly aligned targets.
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