fix(runtime): a refused late load closes the checked file's handle twice
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- cpp
- Domain
- operating-systems
Research direction
Start in src/runtime/ext/plugin_loader.cpp at PluginLoadFilter, where entry->handle = h is set, and find the if (!enforcing) refusal branch that calls CloseHandle(h) before returning. The FilterState::Verified destructor also closes handle, so the double close is there. Write a test that counts closes on the file's handle for a refused late load and expects exactly one. Done when that test passes with the second close removed or the handle cleared after closing.
Written by the indexing model from the issue text.
Description
Evidence at 689ef6896
src/runtime/ext/plugin_loader.cpp,PluginLoadFilter:entry->handle = h;(theVerifiedentry owns the handlehof the file being checked).FilterState::Verified::~Verifiedcloseshandlewhen it is notINVALID_HANDLE_VALUE.- On the path where the check refused the file and the filter goes on to the
if (!enforcing)branch, the function callsCloseHandle(h);and returns;entryis still alive and still holdsh, so its destructor closes the same handle value a second time. - On the accepted path the entry is moved into
f.verifiedand the handle is not closed by the function (return false;comes first), so only the refusal path is affected.
Not shown
- That another thread can be handed the same handle value between the two closes in a real run. In a process where a handle value is reused, the second close would shut an unrelated handle; in a debugger or with Application Verifier it raises an invalid-handle exception.
- Whether Wine reports the second close.
Falsifier
A test (or a run under a handle-checking tool) that makes a late load refused by the plugin gate and sees only one CloseHandle on the file's handle would show this wrong.
Work
- Test first: a refused late load closes the file's handle exactly once (a seam that counts closes, or a duplicated handle the test checks is still valid afterwards).
- Fix: close it in one place. Either drop the
CloseHandle(h)on the refusal path and let the entry close it, or clearentry->handleafter the close.
- Dominant language
- C++
- Stars
- 2
- Forks
- 5
- Avg merge
- 4h 12m
- Merged PRs (30d)
- 788
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EchoTools/nevr-runtime
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
EchoTools/nevr-runtime#2736 ·
Maintainers usually reply within 1 day
-
just: test-quest-combat exits 1 without the combat script libraries after every host test passedOpenbacklog bug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
EchoTools/nevr-runtime#2665 ·
Maintainers usually reply within 1 day
-
backlog bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
EchoTools/nevr-runtime#2664 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
EchoTools/nevr-runtime#2618 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
EchoTools/nevr-runtime#2615 ·
Maintainers usually reply within 1 day
All issues in EchoTools/nevr-runtime
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
mw00/project-maya#983 · 1 comment ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
StarRocks/starrocks#83246 · 1 comment ·
Maintainers usually reply within 1 day