Fix segfault in GC standalone large pages emulation mode (segments path)#127763
Fix segfault in GC standalone large pages emulation mode (segments path)#127763cshung wants to merge 1 commit intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @JulieLeeMSFT, @dotnet/gc |
Change virtual_alloc to accept an integer large_pages_config parameter (0=none, 1=real large pages, 2=emulation) instead of a boolean. When config=2, use VirtualReserve followed by VirtualCommit to emulate large page behavior without requiring OS large page privileges. Update the test to use per-object-heap hard limits which are required for the segments path with large pages.
86e5612 to
0aaa427
Compare
|
I am not convinced whether we should do this for segments. In fact we should be looking at not shipping clrgc.dll given that regions have been live for 3+ releases already |
I think we should still maintain this path for two reasons:
The fix itself is small and straightforward — it passes the large page config as an integer through |
|
is the x86 case broken due to the new changes here? |
No, x86 is good:
|
In the non-regions (segments) path,
GCLargePages=2(emulation mode) was not handled byvirtual_alloc. The function only had abool use_large_pages_pparameter, so it could not distinguish between real large pages (VirtualReserveAndCommitLargePages) and emulation mode (which needsVirtualReserve+VirtualCommit). In emulation mode, memory was reserved but never committed, causing a segfault on access.Fix: Change
virtual_allocto accept anint large_page_configparameter:0= no large pages (reserve only)1= real large pages (VirtualReserveAndCommitLargePages)2= emulation (VirtualReserve+VirtualCommit)The caller computes
large_page_configonce and passes it throughreserve_initial_memory, eliminating the need forreserve_initial_memoryto access the staticlarge_pages_emulation_mode_pfield.The test is updated to use per-object-heap hard limits (
GCHeapHardLimitSOH/LOH/POH), which are required for the segments path with large pages since each segment is sized to the full hard limit (soh + loh + poh = 3x limit with a single combinedGCHeapHardLimit).Fixes #127668