Repository navigation
fix: add crash diagnostics for ARM64 power notification crash - #51198
Merged
Merged
Conversation
dsanders11
approved these changes
Apr 21, 2026
deepak1556
marked this pull request as draft
April 21, 2026 07:10
On ARM64 Windows, UnregisterSuspendResumeNotification (user32) forwards to PowerUnregisterSuspendResumeNotification (powrprof), which treats the HPOWERNOTIFY handle as a pointer and dereferences it. The user32 API returns an opaque handle, not a pointer-backed allocation, causing an access violation at shutdown. Add crash keys (pm-reg-handle, pm-reg-memstate, pm-unreg-memstate) to capture - The handle value - VirtualQuery memory state at both registration and unregistration If the handle address is MEM_FREE, it confirms the handle is an opaque index and powrprof is incorrectly dereferencing it. If MEM_COMMIT, it would indicate a use-after-free of the underlying allocation. Refs https://github.com/MicrosoftDocs/sdk-api/blob/docs/sdk-api-src/content/powerbase/nf-powerbase-powerunregistersuspendresumenotification.md
deepak1556
force-pushed
the
robo/add_pm_crash_keys
branch
from
April 21, 2026 07:16
fde1c2a to
850df67
Compare
deepak1556
marked this pull request as ready for review
April 21, 2026 08:35
|
Release Notes Persisted
|
Contributor
|
I have automatically backported this PR to "42-x-y", please check out #51205 |
3 tasks done
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores #47162 removed the WM_POWERBROADCAST handling from powerMonitor's message window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session.
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores (#54352) * fix: stop registering powerMonitor for Windows suspend notifications it ignores #47162 removed the WM_POWERBROADCAST handling from powerMonitor's message window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session. * fix: complete ui::SessionChangeObserver where PowerMonitor is destroyed and emit directly ~PowerMonitor() is defined in electron_api_power_monitor.cc, which only saw the forward declaration, so the unique_ptr member did not compile on Windows. The session change callback already runs on the UI thread, so emit there instead of posting an Unretained task that nothing can cancel.
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores (#54384) * fix: stop registering powerMonitor for Windows suspend notifications it ignores #47162 removed the WM_POWERBROADCAST handling from powerMonitor's message window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session. Co-authored-by: Sam Attard <[email protected]> * fix: complete ui::SessionChangeObserver where PowerMonitor is destroyed and emit directly ~PowerMonitor() is defined in electron_api_power_monitor.cc, which only saw the forward declaration, so the unique_ptr member did not compile on Windows. The session change callback already runs on the UI thread, so emit there instead of posting an Unretained task that nothing can cancel. Co-authored-by: Sam Attard <[email protected]> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Sam Attard <[email protected]>
MarshallOfSound
added a commit
that referenced
this pull request
Sep 25, 2026
…it ignores (44-x-y) (#54408) fix: stop registering powerMonitor for Windows suspend notifications it ignores (#54352) * fix: stop registering powerMonitor for Windows suspend notifications it ignores window (suspend/resume come from base::PowerMonitor), but left the RegisterSuspendResumeNotification() call behind. That registration no longer fed anything and its unregistration is the ARM64 shutdown crash that #50045, #50878 and #51198 have been chasing. Drop the private message window entirely and take session lock/unlock from ui::SessionChangeObserver, which registers WTS notifications on the UI thread's singleton window and already filters to the current session. * fix: complete ui::SessionChangeObserver where PowerMonitor is destroyed and emit directly ~PowerMonitor() is defined in electron_api_power_monitor.cc, which only saw the forward declaration, so the unique_ptr member did not compile on Windows. The session change callback already runs on the UI thread, so emit there instead of posting an Unretained task that nothing can cancel. (cherry picked from commit 98704f6)
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.
Description of Change
For #51190
On ARM64 Windows,
UnregisterSuspendResumeNotification(user32) forwards toPowerUnregisterSuspendResumeNotification(powrprof), which treats theHPOWERNOTIFYhandle as a pointer and dereferences it.The exception was at x19 which carries the callee register x0 the handle value
Add crash keys (pm-reg-handle, pm-reg-memstate, pm-unreg-memstate) to capture
If the handle address is
MEM_FREE, it confirms the handle is an opaque index and powrprof is incorrectly dereferencing it. IfMEM_COMMIT, it would indicate a use-after-free of the underlying allocation.Refs https://github.com/MicrosoftDocs/sdk-api/blob/docs/sdk-api-src/content/powerbase/nf-powerbase-powerunregistersuspendresumenotification.md
Release Notes
Notes: Added crash keys to diagnose power monitor shutdown crash on arm64 windows.