Skip to content

fix: review findings before 0.4.9 - #67

Merged
Rovey merged 7 commits into
mainfrom
fix/pre-0.4.9
Nov 4, 2026
Merged

Rovey merged 7 commits into
mainfrom
fix/pre-0.4.9

Conversation

@Rovey

@Rovey Rovey commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

Why

Before 0.4.9 the changes since v0.4.8 (#62, #65, #66) got a correctness review, the updater and elevation got a security review, and the whole repo got an over-engineering audit. This PR fixes what they found that is safe to fix without a hardware test. A second review of this branch found that the first restart fix did not work (an elevated process gets no UAC prompt for "runas"); the last commit replaces it.

What

Bugs (all in code that is not released yet)

  • After one Abort, every later run in the session had no Abort button. follow_run now forgets the Abort when it follows a new run. Test added.
  • All in one: every way out after the card was touched ends at stock and says so. The window used to claim "The card is back at stock." without checking when the overclock failed, its save failed, or the run was aborted in step 2 or 3.
  • An Abort in All in one step 2 shows the calm "Stopped" page, not a red fault.
  • An aborted driver retest whose reset to stock failed says so (unless the earlier tune was put back after all).
  • Tray Re-apply / Revert balloons kept working only until the session had 100 notes.
  • The Dashboard hint "click Apply saved tune" shows only where that button is; during the app's own run the offsets under test are not called "Set by another program".
  • The several-GPU refusal at logon was in the log twice; links in log lines get a line of their own.

Security

  • An elevated copy that is not in Program Files never starts itself again (after an update or a driver fault): in the unzip folder any program of the user could have swapped the exe, and the new copy would inherit the rights without a prompt. After an update it asks the user to start it again; after a fault it writes that to boot.log and closes. The Program Files copy (apply at logon) and unelevated copies restart as before.
  • pdh.dll and bcrypt.dll are delay-loaded like the other non-KnownDLLs, so they resolve from System32 only (checked with dumpbin /dependents). Both executables share one gao_exe_link target for these link options.
  • An update unpacks only gao.exe and GpuAutoOptimizer.exe.

Cleanup

  • Removed stock_point_for (no caller), kIconStop, the dead tray WM_COMMAND cases, and two tests that checked a literal against itself and std::function.
  • One kTrayWindowClass; --curve-flatten uses kAlreadyRunning; --optimize parses its preset with preset_from_name.

Not in this PR

  • Merging the run set-up that run_optimize and run_undervolt copy (their crash paths have drifted): it needs a dxcap -forcetdr check under both runs.
  • A signature on release zips (the GitHub account is the only trust root of the updater); "immutable releases" in the repo settings is the quick step.

Tests

  • cmake --workflow --preset ci: builds with /W4 /WX; core_tests and app_tests pass.
  • gao --status and GpuAutoOptimizer.exe --demo start (delay-loaded DLLs resolve).
  • Not tried yet: an update from 0.4.8 to a 0.4.9 rc (unpacking only the two exes), and the restart rules after an update and after a driver fault. These belong in the rc's hardware checks.

Added after the first review round

  • The update download gives up after five minutes in all (security finding 5).
  • One saved_tune_for() for --apply, the window's Apply and the undervolt on the saved tune; one own_exe() / runas_self(); shared CLI hooks; Objectives::power removed (audit 4, 8, 9, 10).
  • The About page names api.github.com; docs/development.md states when an elevated copy does not restart.

🤖 Generated with Claude Code

Rovey and others added 7 commits November 4, 2026 10:31
… next

The run screen cleared `aborting` only when it was drawn without a run going,
which never happens: follow_run moves to the results as soon as a run has
ended. After one Abort, every later run in the session showed "Stopping and
putting the card back..." instead of the button. follow_run now forgets the
Abort when it follows a new run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tock

- All in one: every way out after the card was touched now ends at stock
  and says so ("-- card at stock" / "-- reset to stock FAILED"), as the fan
  step already did. The overclock failing, its save failing, an Abort in
  step 2 or 3 and an unreadable profile all used to leave the window to
  claim "The card is back at stock." without checking.
- An Abort in All in one step 2 now shows the calm "Stopped" page instead
  of a red fault with a request for a problem report.
- An aborted driver retest whose reset to stock failed says so, instead of
  only "You stopped the test."

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- "Close that program, then click Apply saved tune" shows only when that
  tune can be applied here (same card and driver), and without
  administrator rights it says to restart as administrator first.
- During the app's own run the offsets under test read as what the run is
  testing, not as "Set by another program".
- A link in a log line gets a line of its own, as on the Results page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tray and log:
- Tray Re-apply and Revert show their balloon again after the session's
  note list is full (100 notes): a counter, not the list's size, tells
  whether they noted something.
- The several-GPU refusal at logon is no longer listed twice in the log.
- The dead WM_COMMAND cases for the tray commands are gone; tray_menu
  handles them itself since TPM_RETURNCMD.

Security (from the pre-0.4.9 review):
- An elevated copy outside Program Files restarts itself (after an update
  or a driver fault) through a UAC prompt instead of passing its rights on
  silently: in the folder the zip was unpacked to, any program of the user
  could have swapped the exe.
- pdh.dll and bcrypt.dll are delay-loaded like the other non-KnownDLLs, so
  they resolve from System32 only. The link options both executables share
  are in one target, gao_exe_link.
- An update unpacks only gao.exe and GpuAutoOptimizer.exe from the zip.

Cleanup:
- Removed stock_point_for (no caller), kIconStop (unused) and two tests
  that checked a literal against itself and std::function.
- One kTrayWindowClass for gao and the tray app; gao --curve-flatten uses
  kAlreadyRunning; --optimize parses its preset with preset_from_name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The previous commit restarted such a copy through "runas", but Windows does
not ask again when the process asking is already elevated: the new copy got
the rights silently, as before. Now a copy that is elevated and not in
Program Files does not start itself again at all:
- after an update it says "Updated to version X. Close GPU Auto Optimizer
  and start it again to use it." and keeps running;
- after a driver library fault it writes that to boot.log and closes.
The copy in Program Files (the one apply-at-logon runs) and unelevated
copies restart as before.

Also: an aborted retest whose reset failed but whose earlier tune was put
back no longer shows the red "FAILED" line next to "Your saved tune is on
the card again", and the em dash in a CMakeLists.txt comment is restored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The WinHTTP timeouts are per call, so a connection that keeps sending a
few bytes at a time could hold an update, and with it Exit and the
restart after a driver fault, for as long as it liked.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…hooks

- saved_tune_for() replaces the three copies of load + decide_boot +
  decision_text in --apply, the window's Apply and the undervolt on the
  saved tune.
- own_exe() and runas_self() replace five hand-written
  GetModuleFileNameW calls and two runas blocks.
- The CLI runs share cli_hooks() and after_tune().
- Objectives::power is gone: it was true wherever it was read.
- The About page names api.github.com, the host the app contacts.
- docs/development.md states when an elevated copy does not restart.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Rovey Rovey mentioned this pull request Nov 4, 2026
1 of 2 tasks
@Rovey
Rovey merged commit ddd7447 into main Nov 4, 2026
2 checks passed
@Rovey
Rovey deleted the fix/pre-0.4.9 branch November 4, 2026 22:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant