xtask: bound policy file reads and report read errors #3026
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3026
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3026"
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?
@fuzeofficlal on GitHub · 2026-11-26 03:48 UTC · original
fuzeofficlal:fix/xtask-policy-bounded-read-and-errors→main· +258 −22 · 1 files · 1 commits · openSummary
xtask::policy::runpreviously loaded every checked file completely into memory (std::fs::readin working-tree mode andgit show :<path>in--stagedmode) and silently skipped any file whose read orgit showfailed:checkfails on the 512 KiB limit, risking OOM or a long hang incargo xtask policy/.githooks/pre-commit.NotFoundworking-tree read errors (unreadable files, directories/gitlinks) and failing staged lookups (such as staged gitlinks160000wheregit cat-file blobfails) were silently ignored instead of being reported as policy violations.Changes
MAX_FILE_SIZE + 1(524,289) bytes per file into a single reused buffer viaread_prefix:ErrorKind::NotFound(deleted tracked files), reads up toREAD_LIMITbytes, and usesfile.metadata().len()to report the exact oversized file length.--stagedmode streamsgit cat-file blob :<path>and stops reading afterREAD_LIMITbytes (killing/reaping the child when oversized), queryinggit cat-file -s :<path>only when oversized to report the exact blob length.NotFoundworking-tree open/metadata/read errors and non-oversizedgit cat-filefailures as asset-policy violations instead of skipping the entry.NotFounderrors (directories).160000).Verification
rustfmt --edition 2024 --check xtask/src/policy.rs— passcargo test --locked -p xtask— 10 passed, 0 failedcargo clippy --locked -p xtask --all-targets -- -D warnings— passcargo xtask policy—asset policy: 191 files ok@Marvisak on GitHub · 2026-11-26 06:17 UTC · original
Automated triage for the maintainers.
This needs the maintainer's decision. It changes
xtask/src/policy.rs, the asset-policy allowlist that the pre-commit hook runs, and it changes how that tool spawns processes.--stagednow streamsgit cat-file blobthrough a pipe, kills the child when a file is too big, and runs a secondgit cat-file -s. The new tests create temporary git repositories withgit init/update-index.From reading it, the change tightens the policy rather than loosening it.
runstill skipsEXCEPTIONSthe same way. Reads are capped atMAX_FILE_SIZE + 1. Read errors other thanNotFound(and failing staged lookups such as gitlinks) are now reported as violations instead of being skipped silently. Deleted index entries are not affected, becauselist_filesalready passes--diff-filter=ACMR. I found no correctness problem. One point for the maintainer: in working-tree mode, any tracked path that cannot be opened as a file (for example a future submodule gitlink) now failscargo xtask policy. There are none today.CI:
checkpassing.Generated by Claude Code
@kotekompotek on GitHub · 2026-11-26 04:40 UTC · original · approved these changes
LGTM — READ_LIMIT caps staged reads, errors surface as violations instead of silent skips, buffer reuse avoids per-file allocation.
@futurepro62 on GitHub · 2026-11-26 20:40 UTC · original
Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head
40d280e(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 870 passed, 0 failed, 10 ignored.worktree_reads_only_a_bounded_prefix_of_an_oversized_file,worktree_skips_missing_files_and_surfaces_other_read_errors,staged_reads_regular_blobs_and_rejects_gitlinks,staged_reads_only_a_bounded_prefix_of_an_oversized_blob.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.