Repository navigation
Validate malformed responses from HDFS DataNode and NameNode - #126546
Conversation
…ameNode Related: ClickHouse/libhdfs3#79 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Workflow [PR], commit [ea532ac] Summary: ✅
AI ReviewSummaryThis PR updates Findings
Tests
Final Verdict |
|
I've merged the fix to HDFS plus two more changes. Update the submodule pointer to the latest. |
|
Changed the category to "Improvement", because no one cares about HDFS. |
| @@ -1 +1 @@ | |||
| Subproject commit ceb428c52e6b4362a35ec18b69206d9bb94edce3 | |||
| Subproject commit d9c26dc4df628219f28904f057d64752c5007704 | |||
There was a problem hiding this comment.
The pinned libhdfs3 commit changes four production files but adds no tests, and this PR adds none either. Existing reads against a normal HDFS server do not exercise the packet offsets or parallel-array mismatches that caused the out-of-bounds accesses, so they can pass with these protections removed.
Please add focused coverage in libhdfs3 and pin the tested revision: a DataNode packet whose offset leaves position > size must throw HdfsIOException before copying, and a NameNode response with mismatched storageTypes/storageIDs must be handled without an out-of-bounds access. Include a valid read starting inside a checksum chunk to prove the new offset validation still accepts the required backward alignment. These can use a small protocol fixture or mocks; they do not need a full HDFS integration cluster.
There was a problem hiding this comment.
🕵 The fix in the submodule was reviewed and merged upstream (ClickHouse/libhdfs3#79), and the pointer now tracks the latest libhdfs3 master (28a9868). The libhdfs3 unit tests are not built or run in ClickHouse CI, so the requested protocol fixtures (a DataNode packet with position > size, a NameNode response with mismatched storageTypes/storageIDs) would belong in a follow-up PR to the libhdfs3 repository rather than here. A ClickHouse-side test would need a deliberately malformed HDFS server, which is out of proportion for this change. Leaving this thread open for a maintainer decision on whether that follow-up is wanted.
|
@rschu1ze, do not merge red. The stress test has failed. |
alexey-milovidov
left a comment
There was a problem hiding this comment.
The code LGTM.
|
The fix is #125567 (open, CI finished, waiting for review). The failure is not related to the libhdfs3 bump. The aborting query ( Reduced form: CREATE TABLE t (value LowCardinality(Float64) CODEC(arrayMap(plus(_, 65537) | toString, [1, 2]), ALP, ZSTD(3))) ENGINE = MemoryIt aborts a current master debug build ( |
…lformed-responses
As requested in the PR discussion, bump the pointer to the tip of `ClickHouse/libhdfs3` `master`, which also brings slow DataNode avoidance and an HDFS timeout fix. Add the new `SlowMetrics.cpp` and `SlowNodeTracker.cpp` sources to the build. The new revision also contains unit tests (`TestSlowMetrics`, `TestSlowNodeTracker`) in the `libhdfs3` repository. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
🕵 @groeneai, investigate the failures: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=126546&sha=1b4f834586b7e310c2e9021e6459376128297985&name_0=PR&name_1=Stress%20test%20%28arm_release%29 ( Also: the submodule now points to the latest |
|
Both already have fixes in my open PRs:
|
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes22 object files changed (+146.09 KiB total), 2 added.
719 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units44 translation units recompiled, 101 s compile time in total, 6 of them have a recent master baseline. |
Backport #126546 to 26.10: Validate malformed responses from HDFS DataNode and NameNode
Backport #126546 to 26.9: Validate malformed responses from HDFS DataNode and NameNode
Backport #126546 to 26.8: Validate malformed responses from HDFS DataNode and NameNode
Backport #126546 to 26.7: Validate malformed responses from HDFS DataNode and NameNode
Backport #126546 to 26.3: Validate malformed responses from HDFS DataNode and NameNode
… HDFS DataNode and NameNode
Update
libhdfs3to validate malformed responses from the HDFS DataNode and NameNode. Previously, inconsistent packet offsets sent by a DataNode could lead to an out-of-boundsmemcpyinRemoteBlockReader, and block locations from a NameNode with mismatchedstorageTypesandstorageIDsarrays led to an out-of-bounds read. Now such responses throw an exception.Related: ClickHouse/libhdfs3#79
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix a possible crash or out-of-bounds memory access when reading from HDFS if a DataNode or NameNode sends malformed responses.
🤖 Generated with Claude Code
Workflow [PR]
Sync PR [sync-upstream/pr/126546]
Version info
26.11.1.435-master(included in26.11and later)26.10.2.65,26.9.24.15,26.8.34.6,26.7.37.8,26.3.59.7