Repository navigation
Commit 42fd0cc
Fix Mono Windows x64 hardware exception continuations (dotnet#133774)
## Summary
Fix Windows x64 Mono MiniJIT hardware-exception handling when Windows
validates exception-continuation addresses. The vectored exception
handler currently resumes directly at a dynamically generated managed
handler; affected processes terminate with
`FAST_FAIL_SET_CONTEXT_DENIED` instead of entering the catch.
Save the resolved managed handler context in existing thread-local
storage and resume first at a native runtime entry point, which restores
that context through Mono's existing restore trampoline. Supply the
Win64 entry-stack alignment and argument home area, and keep the
stack-overflow restoration context separate from the native
continuation. This does not change process mitigation settings or add
general CET support.
Add a three-case theory covering repeated divide-by-zero, overflow, and
null-reference exceptions with nested hardware exceptions in filters and
finally blocks. Restore the Windows x64 MiniJIT runtime-test lane
disabled by dotnet#133747 so this PR exercises the full lane.
Fixes dotnet#133702.
## Validation
- Built Release and Debug Mono on Windows x64.
- `div2_d`, `div2_ro`, `HardwareEh`, `unhandledTester`, and
`ExceptionInterop` pass with both native builds in MiniJIT mode.
- The same final `HardwareEh` binary exits with `0xC0000409` on the
saved unfixed runtime and passes on the fixed Release and Debug
runtimes. Verified that its generated entry point invokes all three new
theory cases. It also passes with the Release interpreter.
- Repeated local explicit-throw measurements overlap within measurement
uncertainty: baseline 2.070 us versus candidate 2.008 us. The unfixed
hardware-throw benchmark terminates, so there is no valid before/after
throughput ratio for that path.
- Verified that `eng/pipelines/runtime.yml` exactly matches its
pre-quarantine version. Full MiniJIT CI and cross-platform suites have
not been run locally.
> [!NOTE]
> This PR was generated with GitHub Copilot.
Co-authored-by: Copilot App <[email protected]>1 parent 2e7fb4b commit 42fd0cc
3 files changed
Lines changed: 126 additions & 4 deletions
File tree
- eng/pipelines
- src
- mono/mono/mini
- tests/baseservices/exceptions/simple
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1777 | 1777 | | |
1778 | 1778 | | |
1779 | 1779 | | |
1780 | | - | |
1781 | | - | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
1782 | 1818 | | |
1783 | 1819 | | |
1784 | 1820 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
59 | 66 | | |
60 | 67 | | |
61 | 68 | | |
| |||
156 | 163 | | |
157 | 164 | | |
158 | 165 | | |
159 | | - | |
160 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
161 | 170 | | |
162 | 171 | | |
163 | 172 | | |
| |||
826 | 835 | | |
827 | 836 | | |
828 | 837 | | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
829 | 851 | | |
830 | 852 | | |
831 | 853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
26 | 90 | | |
27 | 91 | | |
28 | 92 | | |
| |||
0 commit comments