Launcher store access: check and use the same handle, and log every open
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start at the LibraryAccess/LibraryRegistryAccess layer added by PR #243 in clean/installer/src/wg_core/util.h; read FinalForm, RealPathOk and FindFilesNamed in util.cpp to see where the checked handle is closed. Follow the candidate path from model.cpp (~141) into clean/converter/src/api.cpp (~81, 227) and convert_ignore.cpp (~309-316) — that is where a handle or bytes must replace the path. Done: a unit test swaps the checked folder or file for a junction and the read is refused; hash and convert each log an access line.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
PR #243 added one store-access layer (clean/installer/src/wg_core/util.h LibraryAccess / LibraryRegistryAccess).
In a WRONGGPU_TESTING build with WRONGGPU_TEST_LIBRARIES set, it confines every store-library read to the test run's
own folder. It refuses paths whose final form differs from their long name, reparse points, files with a second name and
a test folder that resolves elsewhere. It logs every access before the read and refuses a read whose line cannot be
written. The test suite never reads a real store library. Three smaller points remain.
1. Check-then-use: the checked handle is not the read handle
util.cpp checks a path with one handle and closes it. The later read then opens the path again:
FinalForm(around lines 535-541) and the reparse / link-count check inRealPathOk(around 563-568) close their
handles;FindFilesNamedthen enumerates the folder by path (around 636-638) and returns file paths (around 647-648);model.cpp(around line 141) passes such a path to the converter, which opens it again (clean/converter/src/api.cpp
around lines 81 and 227).
If a folder or file is replaced with a junction or link between the check and the use, the read can land somewhere else
while the inside path is logged. In the test suite this needs a concurrent swap inside the suite's own synthetic folders,
so it is not reachable there today. It is still not a strict guarantee.
Proposed:
- Open once with
FILE_FLAG_OPEN_REPARSE_POINT(plusFILE_FLAG_BACKUP_SEMANTICSfor folders). Run the final-path,
reparse and link-count checks on that handle, and use the same handle for the read:- enumerate folders with
GetFileInformationByHandleEx(FileIdBothDirectoryInfo); - read files through the handle.
- enumerate folders with
- Let the converter take an open handle (or a file already read into memory) instead of a path, so the launcher's checked
handle is the one that is read.
2. A log line for every actual open, not only discovery
FindFilesNamed logs each folder walked and each matching file found, but some found files are opened more than once
later without their own access line:
- with a non-empty ignore list,
model.cpp(around lines 61-65) andconvert_ignore.cpp(around 309-316) hash a
candidate, opening it throughutil.cpp(around 660-661); model.cpp(around 139-142) then converts the same candidate, and the converter opens it again.
So a failed log append after discovery does not stop these later reads, and the log cannot account for each open.
Proposed: call LibraryAccess (or the handle-based form from point 1) right before each of these opens, the hash and the
convert, so every open has its own line and the fail-closed rule covers it.
3. Release builds: note what still runs
The final-path, environment and access-log code is compiled only in WRONGGPU_TESTING builds, and LibraryAccess /
LibraryRegistryAccess return true in release builds. Release builds still run two things:
- the unconditional atomic access counter (
LibraryAccessCount; increments aroundutil.cpplines 482, 578 and 605); - the new call sites.
The behaviour is unchanged, but the code path is not literally identical, and no release-build parity test covers it.
Proposed: either keep the counter only in testing builds, or keep it and add a short note to util.h and the README's
Tests section that it is the one piece that runs in release. Add a release-build unit test that LibraryAccess returns
true and changes nothing else.
Done when
- The store-access check and the read use the same handle (folder enumeration and file reads in the launcher; the
converter takes a handle or bytes), with a unit test that swaps a checked folder or file for a junction after the check
and shows the read is refused or stays inside. - Hashing and converting a library candidate each write their own access line, and a failed append refuses them (unit
test). - Release-build behaviour is stated and tested as above.
- Ngôn ngữ chính
- C++
- Star
- 12
- Fork
- 2
- Merge trung bình
- 3 giờ 10 phút
- Pull request đã merge (30 ngày)
- 171
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của phantoslayer21/wronggpu
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
phantoslayer21/wronggpu#275 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
phantoslayer21/wronggpu#274 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
phantoslayer21/wronggpu#241 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
phantoslayer21/wronggpu#234 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Launcher tests: "an older record: update available" fakes a version newer than the test buildĐang mởbug build
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
phantoslayer21/wronggpu#233 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của phantoslayer21/wronggpu
Issue tương tự
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
ReyeMe/SaturnRingLib#155 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Nheko-Reborn/nheko#2092 ·
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 78/100
isocpp/CppCoreGuidelines#2345 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 71/100
ROCm/rocm-libraries#16108 ·
Maintainer thường phản hồi trong vòng 2 ngày