mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #97] Malformed OverlayBD index metadata is trusted before buffer allocation #33
Labels
No labels
bug
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
kvcache-ai/AgentENV#33
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @morluto on GitHub (Jul 31, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/97
Affected component
OverlayBD / image resolution
AgentENV version
f41abb21324f6b0520abf34b7720aa260ddd10ebHost environment
7.0.0-28-genericx86_64Operation and configuration
Opening an untrusted or corrupted sealed OverlayBD layer through the normal read-only layer path. No special configuration is required.
The trailer controls both values passed to the index loader:
At
f41abb2,verify_htvalidates the trailer magic/type but does not validate the index range.load_indexthen computes:The allocation occurs before the implementation checks whether the described range exists in the backing file.
Affected paths:
storage/overlaybd/src/lsmt/file/helper.rs—verify_ht,load_index, andload_index_and_reset_tagsstorage/overlaybd/src/lsmt/file/readonly.rs— passes trailer metadata into the loaderstorage/overlaybd/src/lsmt/file/stack.rs— parallel lower-layer index loadingSteps to reproduce
This is a source-derived reproduction that avoids deliberately requesting an out-of-memory allocation:
HeaderTrailerwhile preserving valid magic/type fields.index_offsetbeyond the start of the trailer;index_sizesoindex_offset + index_size * sizeof(DiskSegmentMapping)exceeds the file; orindex_sizeabove the checked multiplication/conversion limit.LSMTReadOnlyFileoropen_file_index.The focused regression cases used to validate the proposed invariant are:
Expected behavior
Before allocating or reading an index, reject metadata unless all of these conditions hold:
index_size * sizeof(DiskSegmentMapping)is representable;Actual behavior
The current loader trusts the trailer-provided count long enough to calculate and allocate the index buffer. File bounds are only discovered by the later read, so an oversized count can cause excessive allocation or arithmetic failure before a normal malformed-layer error is returned.
No server log is required to establish the ordering: the allocation-before-read sequence is directly visible in
load_index.Reproduction frequency
Always for a layer containing the corresponding malformed trailer values.
Regression information
f41abb21324f6b0520abf34b7720aa260ddd10eb.Scope and acceptance criteria
usize.This report does not claim that an out-of-memory condition was executed on the audit host; that impact follows from the confirmed allocation ordering. The bounded malformed-metadata cases were exercised without KVM or ublk.
Pre-submission checks