-
Notifications
You must be signed in to change notification settings - Fork 566
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
i#6921: Fix heap allocation on latest Linux kernel (#6922)
Fixes 3 problems hit on recent Linux kernels where our mmap hints are being ignored: 1) os_heap_reserve_in_region()'s POINTER_MAX check fails as the end is aligned, causing an unnecessary bounded-region search. 2) vmm_place_vmcode() tries smaller sizes on failure but does not propagate the new size to the caller, resulting in memory corruption. 3) os_heap_reserve() for Linux now uses the new-ish MAP_FIXED_NOREPLACE to get the behavior various code expects without risk of clobbering. Tested on a 6.7.12 kernel where raw2trace failed up front reliably without these fixes but now succeeds. Further tested the size propagation with the other fixes disabled and now we have a graceful failure instead of memory corruption and a weird crash: ``` $ clients/bin64/drmemtrace_launcher -indir drmemtrace.*.dir <Full size vmm heap allocation failed> <Application <path>/clients/bin64/drmemtrace_launcher (3686844). Out of memory. Program aborted. Source I, type 0x0000000000000001, code 0x0000000000000001.> ``` Fixes #6921
- Loading branch information
1 parent
86c9689
commit d302f5e
Showing
2 changed files
with
44 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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