fix(dstack-util): reject a LUKS keyslot area whose end overflows - #1280
Merged
Merged
Conversation
kvinwang
force-pushed
the
fix/config-parser-bounds
branch
from
September 24, 2026 08:41
e49a6d4 to
5107a31
Compare
This was referenced Sep 24, 2026
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.
Problem
validate_single_luks2_headerchecks that the keyslot binary area sits between the header copies and the payload, usingarea.offset() + area.size() > PAYLOAD_OFFSET. Both values come from the host-supplied on-disk header. In release (overflow checks off) a hugesizewraps the sum underPAYLOAD_OFFSETand the header is accepted; in debug it panics. This runs on every boot with an existing encrypted data disk.Fix
Use
checked_add; a sum that overflows is out of range. A regression test patches both header copies of theluks_header_goodfixture with an overflowing size. The existing out-of-range test now uses the same patch helper.Verification
cargo test -p dstack-util(109 passed, passes in debug and release), clippy and fmt clean.