Front end hardening: bound the descriptor-chain walk, thin query and configure log lines
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 64/100
- Issue 類型
- 缺陷
- 描述清晰度
- 描述清楚
- 活躍度
- 活躍
- 技術堆疊
- cpp
研究方向
Start in clean/fsr/src/frontend.cpp: the pNext walk in CreateContext (~line 460) and CreateUpscale (~533), and the logging in Query (~1445) and Configure (~1195), which should use ShouldLogDispatch (~446). Read config.h:113 and log_win.h:137 for the log_dispatches and size rules. Done when a self-referencing chain returns FFX_API_RETURN_ERROR_PARAMETER in a CPU test, and 1200 jitter queries with log_dispatches=1 leave about 2 query lines.
由索引模型根據 Issue 內容生成。
描述
Two small, independent changes in clean/fsr/src/frontend.cpp. Found by reading the code; neither has been reproduced.
1. The descriptor-chain walk is not bounded
What happens
The walk over the pNext chain in CreateContext (:460) has no bound, and neither has the walk in CreateUpscale (:533). A chain that points back to itself would hang the calling thread. DescribeChain (clean/fsr/src/ffx_describe.cpp:337) stops at 16 nodes and CreateAmdWithoutPrivateVersion (frontend.cpp:192) stops at 64.
When it can happen
Only for a caller that breaks the API contract. A cyclic chain is malformed input, and AMD's runtime walks the same chains when a call is forwarded to it. No working game or host sends one.
To do
At the top of CreateContext, walk the chain once with a bound of 64 (the existing limit) and return FFX_API_RETURN_ERROR_PARAMETER if it is exceeded. CreateUpscale then only sees chains that passed.
Test
CPU. Build a two-node chain that points back to itself, call fe->CreateContext, and expect ERROR_PARAMETER. Without the change the test hangs, so the runner's timeout catches it.
2. Query and configure log lines are not thinned with log_dispatches = 1
What happens
log_dispatches is documented to thin dispatch lines to one in 600 above the log size limit (clean/fsr/src/config.h:113, clean/fsr/README.md:124). ShouldLogDispatch (frontend.cpp:446) does that. Query (:1445) and Configure (:1195) use seen < 3 || config_.logDispatches instead and never thin. A game that queries the jitter every frame keeps writing about two lines per frame after the log passes log_max_mb. The text log is only moved aside when it is opened, above 8 MiB (clean/fsr/src/log_win.h:137).
When it can happen
Only with log_dispatches = 1, a diagnostic setting that is off by default, over a long session. With the default only the first 3 calls of each type are logged.
To do
In both places, use seen < 3 || (config_.logDispatches && ShouldLogDispatch(seen)). Failed calls are still always logged. A live size cap for the text log is optional; if added, it has to coordinate with the writer's write_mutex_.
Test
CPU. Give the front end a stand-in platform_.logBytes that returns more than log_max_mb, set log_dispatches = 1, run 1200 jitter queries, and check that the log holds about 2 query lines, not 1200.
- 主要語言
- C++
- 星號
- 12
- 分支
- 2
- 平均合併
- 3 小時 10 分鐘
- 30 天內合併 PR
- 171
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
phantoslayer21/wronggpu 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 88/100
phantoslayer21/wronggpu#275 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 82/100
phantoslayer21/wronggpu#274 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 88/100
phantoslayer21/wronggpu#241 ·
維護者通常 1 天內回覆
-
bug build
難度 2/5 1-3 小時 新手友好度 74/100
phantoslayer21/wronggpu#234 ·
維護者通常 1 天內回覆
-
bug build
難度 2/5 1-3 小時 新手友好度 80/100
phantoslayer21/wronggpu#233 ·
維護者通常 1 天內回覆
查看 phantoslayer21/wronggpu 的全部 Issue
相似的 Issue
-
ai_p2
難度 2/5 1-3 小時 新手友好度 80/100
ClickHouse/ClickHouse#132519 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
juce-framework/JUCE#1810 ·
-
難度 1/5 1 小時以內 新手友好度 82/100
petercorke/robotics-toolbox-python#952 ·
維護者通常 1 天內回覆
-
NatronRenderer: a Python error in the script (-t / project script) doesn't change the exit status未關閉func:engine type:bug
難度 2/5 1-3 小時 新手友好度 72/100
NatronGitHub/Natron#1276 ·
維護者通常 1 天內回覆
-
難度 1/5 1-3 小時 新手友好度 77/100
維護者通常 1 天內回覆