mirror of
https://github.com/kvcache-ai/AgentENV.git
synced 2026-11-05 01:17:36 +00:00
[GH-ISSUE #40] LSMT mapped reads silently zero-fill truncated backing data #16
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#16
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 28, 2026).
Original GitHub issue: https://github.com/kvcache-ai/AgentENV/issues/40
Problem
The readonly and readwrite LSMT mapped-read paths treat a short physical read from a backing layer as valid data followed by zeros.
That makes a truncated or incomplete mapped extent indistinguishable from an intentional sparse hole. Because OverlayBD backs AgentENV root filesystems and memory snapshots, callers can receive invented zero bytes instead of an I/O error.
Current behavior
LSMTReadOnlyFile::read_internal_into_genericandLSMTFile::read_mappings_into_genericfill the unread portion of the destination buffer with zeros when a mapped physical read returns fewer bytes than requested.Explicit holes and zero mappings are handled separately, so a short read from a mapped extent should not use the same zero-fill behavior.
Expected behavior
Impact
A truncated local, registry-backed, or otherwise incomplete layer can be exposed as apparently valid filesystem or VM-memory data. Surfacing the read failure preserves the distinction between sparse data and backing-layer corruption.
@yingdi-shan commented on GitHub (Jul 29, 2026):
Thank you so much! Could you please share the steps to reproduce this issue?
@morluto commented on GitHub (Jul 29, 2026):
Yes. This is reproduced by the focused OverlayBD unit test in #43; it does not require starting AgentENV or using KVM.
The test creates a 4 KiB mapped extent backed by only 3968 physical bytes and exercises both the read-only and read-write LSMT paths.
I also ran the test against the parent implementation while retaining the regression test. The old implementation returned
Okand left the missing 128-byte tail zero-filled; the fixed implementation returnsunexpected EOF.