Repository navigation
fix: terminate immediately on asar integrity violation - #53433
Merged
MarshallOfSound merged 3 commits intoSep 3, 2026
Merged
Conversation
The JS-side asar integrity check ends the process via process.reallyExit(1), which bottoms out in libc exit(). That runs atexit handlers and static destructors on the main thread while Chromium's threads are still live, and on Windows intermittently dies with an access violation (0xC0000005) before reaching ExitProcess, so the process exits with the wrong code. Terminate via base::Process::TerminateCurrentProcessImmediately instead so nothing else runs and exit code 1 is preserved. Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj
dsanders11
marked this pull request as ready for review
September 3, 2026 02:43
dsanders11
approved these changes
Sep 3, 2026
MarshallOfSound
approved these changes
Sep 3, 2026
MarshallOfSound
deleted the
fix/asar-integrity-violation-exit-immediately
branch
September 3, 2026 04:55
|
Release Notes Persisted
|
Contributor
|
I was unable to backport this PR to "43-x-y" cleanly; |
Contributor
|
I was unable to backport this PR to "44-x-y" cleanly; |
Contributor
|
I have automatically backported this PR to "45-x-y", please check out #53438 |
Contributor
|
@MarshallOfSound has manually backported this PR to "44-x-y", please check out #53455 |
Contributor
|
@MarshallOfSound has manually backported this PR to "43-x-y", please check out #53456 |
MarshallOfSound
added a commit
that referenced
this pull request
Sep 3, 2026
fix: terminate immediately on asar integrity violation (#53433) * fix: terminate immediately on asar integrity violation The JS-side asar integrity check ends the process via process.reallyExit(1), which bottoms out in libc exit(). That runs atexit handlers and static destructors on the main thread while Chromium's threads are still live, and on Windows intermittently dies with an access violation (0xC0000005) before reaching ExitProcess, so the process exits with the wrong code. Terminate via base::Process::TerminateCurrentProcessImmediately instead so nothing else runs and exit code 1 is preserved. Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj * refactor: drop dead exit fallbacks after exitImmediately Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj * refactor: move exitImmediately to the v8_util binding Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj --------- (cherry picked from commit 18e2caa) Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <[email protected]>
MarshallOfSound
added a commit
that referenced
this pull request
Sep 3, 2026
fix: terminate immediately on asar integrity violation (#53433) * fix: terminate immediately on asar integrity violation The JS-side asar integrity check ends the process via process.reallyExit(1), which bottoms out in libc exit(). That runs atexit handlers and static destructors on the main thread while Chromium's threads are still live, and on Windows intermittently dies with an access violation (0xC0000005) before reaching ExitProcess, so the process exits with the wrong code. Terminate via base::Process::TerminateCurrentProcessImmediately instead so nothing else runs and exit code 1 is preserved. Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj * refactor: drop dead exit fallbacks after exitImmediately Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj * refactor: move exitImmediately to the v8_util binding Claude-Session: https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj --------- (cherry picked from commit 18e2caa) Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com> Co-authored-by: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requested by David Sanders · Slack thread
Description of Change
Before: When an ASAR integrity violation is detected in JavaScript (the
asar-fs-wrapper.tsblock/file hash checks), the process is torn down withprocess.reallyExit(1), which bottoms out in libcexit(1). That runs atexit handlers and static destructors on the main thread while Chromium's IO thread, ThreadPool and friends are still live. On Windows this intermittently dies with an access violation (0xC0000005 = 3221225477) before the CRT reachesExitProcess, so the process exits with the wrong code. This is theexpected 3221225477 to equal 1flake inspec/asar-integrity-spec.ts, and for a shipping app it means a tampered archive would randomly crash instead of exiting with code 1.After: The violation path calls
base::Process::TerminateCurrentProcessImmediately(1)(TerminateProcesson Windows,_exiton POSIX) right after the message is written to stderr. Nothing else runs in-process, so there is no destructor/thread interleaving to lose, and the exit code is 1 on all platforms.How: Adds an internal
exitImmediately(code)method to theelectron_common_v8_utilbinding (alongside the other process-level internal helpers such asrunUntilIdleandtriggerFatalErrorForTesting), andintegrityViolationinlib/node/asar-fs-wrapper.tsnow calls it after writing the message instead ofprocess.reallyExit(1). No public API is added andprocess.exit()behaviour is unchanged. The message is already written with an unbufferedfs.writeSync(2, ...), so nothing is lost by skipping the normal exit sequence. The C++LOG(FATAL)detection sites are unchanged; they crash by design and the spec expects that.Evidence: Six failing win-x64
testjobs were examined (e.g. https://github.com/electron/electron/actions/runs/33682957442). Every one of the 33 in-job failures is the identicalAssertionError: expected 3221225477 to equal 1; there is never a hash error or areadfile-ok/stream-okresult that would indicate the check itself misbehaved. Only the async JS-detected variants fail (terminates a stream when it reaches corrupted block 0at 22/24 attempts,(stream)7/10,(handle)6/9); the C++LOG(FATAL)variants (header, main-process JS, renderer file) never fail, and the spec usesexpectToHaveCrashedfor those. One sampled greenmainwin-x64 job had the same(stream)failure masked by the in-suite retry, so the real rate is higher than the visible one.Verification: Not built or run here (this was prepared in a Linux environment that cannot build Electron). The existing Windows
asar integritytests inspec/asar-integrity-spec.tsare the regression test for this change; a Windows run of that spec looped on a runner that previously failed the block-0 test should show no 0xC0000005 exits.This is the same class of problem as #52856, which added
TearDownOncePerProcess()before the pre-readyapp.exit()exit()call inbrowser.cc. Follow-ups not included in this PR: installing anode::SetProcessExitHandlerin the browser process so anyprocess.reallyExitavoids libcexit(), and giving the pre-readyexit()inbrowser.ccthe same treatment.Checklist
npm testpasses (not run here;lint:js,oxfmt --checkand clang-format pass on the changed files)spec/asar-integrity-spec.tstests; no new tests)Release Notes
🤖 Generated with Claude Code
https://claude.ai/code/session_01PBKD1L6FXPM4TQBiNcicTj
Notes: Fixed an intermittent crash (access violation) on Windows when an ASAR integrity violation is detected, so the process now exits with code 1 as intended.