Conversation
|
Pushed a follow-up for the CI failures. The first issue was formatting in The update keeps the non-SWMR metadata size checks in place, removes the too-early continuation-message EOA check, and skips this cache-entry EOA validation only for Local verification:
|
| * EOA cache is refreshed. Lower VFD read paths already bypass EOA | ||
| * validation for SWMR reads and rely on read retries / EOF handling. | ||
| */ | ||
| if (H5F_INTENT(f) & H5F_ACC_SWMR_READ) |
There was a problem hiding this comment.
I'm somewhat suspicious about the need for this addition; does this become an issue only after the addition of the call to H5C__verify_len_eoa() in H5C__load_entry()? That sticks out to me as indicating that H5C__load_entry() may not be the place this issue needs to be solved at.
There was a problem hiding this comment.
Yes—the conflict was specific to applying the new non-speculative EOA check to SWMR readers. I kept the validation in H5C__load_entry() because this is the common point after the client computes len and immediately before allocating len + H5C_IMAGE_EXTRA_SPACE; validating later in a decoder would be after the allocation we need to bound. The SWMR exception is now scoped only to that new non-speculative call site, while the shared helper retains its pre-existing behavior for speculative clients. The focused cache and full ohdr binaries pass in a Debug build.
e4b02ab to
4faca29
Compare
4faca29 to
397b13b
Compare
|
Are there later checks that could be changed into asserts with this change? Or are there other paths to reach those later checks besides through H5C__load_entry()? |
9d90808 to
1349ae7
Compare
|
Rebased this branch onto current Local verification on
|
|
|
||
| Fixes GitHub issue #6531 | ||
|
|
||
| ### Fixed bug that prevented internal library filters from printing error messages |
There was a problem hiding this comment.
It looks like the CHANGELOG.md conflict got merged in a way that brought in a bunch of unrelated messages from 2.2.0.
1349ae7 to
f90df7b
Compare
|
Good catch — the CHANGELOG conflict resolution on 2026-08-20 accidentally pulled in a large block of unrelated 2.2.0 entries (62 lines, from the "Fixed bug that prevented internal library filters" section down through the "incorrect file format validation check" entry). Force-pushed |
|
|
||
| Fixes GitHub issue #6531 | ||
|
|
||
| ### Hardened decoding of serialized dataspace selections against malformed buffers |
There was a problem hiding this comment.
This CHANGELOG message is from #6525 and should not be included in this PR
f90df7b to
38180fb
Compare
|
Good catch — removed. That entry was for #6525 and got pulled in during the CHANGELOG conflict resolution. Force-pushed No code changes in this push — |
| ### Added pre-allocation validation for metadata cache entry image sizes | ||
|
|
||
| Metadata cache entries with non-speculative load sizes are now checked against the file's end of | ||
| allocation before allocating the on-disk image buffer. Object header continuation messages also |
There was a problem hiding this comment.
file's end of allocation -> file's end-of-allocation address
…cache-load-size # Conflicts: # release_docs/CHANGELOG.md
|
Rebased onto current |
|
Is there a possibility that a speculative load in SWMR read mode could inappropriately run afoul of this check, since the reader might not see the updated EOA before reading a reference to a new piece of metadata? Or are metadata clients that use speculative loads not allowed to be written in SWMR mode by the current SWMR implementation? I realize this would be a problem in the current code (before this PR) as well. |
|
Yes — for a hypothetical speculative cache client in SWMR read mode, the existing final-size check could reject an entry when the reader has a stale EOA. I checked the current cache client definitions as well: no production HDF5 metadata client sets The new pre-allocation guard applies only to non-speculative loads and explicitly skips SWMR readers. A future production client that adopts speculative loads would need to decide how its final-size validation should synchronize with SWMR EOA visibility, but this PR preserves the pre-existing speculative behavior. |
Describe your changes
This hardens malformed-file handling for metadata cache entry loads:
ohdrregression that creates an object header continuation chunk, corrupts the encoded continuation size on disk, and verifies the malformed object header is rejected before the cache allocates that size.This prevents malformed metadata from driving very large allocations before the later file-read/EOA checks run.
AI assistance disclosure: this patch was prepared with assistance from OpenAI Codex. I reviewed the changes and ran the verification below locally.
Issue ticket number (GitHub or JIRA)
N/A
Checklist before requesting a review
Local verification
git diff --check origin/develop..HEADcmake --build build-asan-o0 --target ohdr h5dump -j$(nproc)ASAN_OPTIONS=detect_leaks=0:allocator_may_return_null=0:abort_on_error=1 timeout 180s build-asan-o0/bin/ohdrbuild-asan-o0/bin/h5dump -H test/testfiles/tmtimeo.h5