Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mcount-dynamic: Use MAP_FIXED_NOREPLACE for trampoline
By trying to allocate the extra page for a trampoline with MAP_FIXED, Uftrace could end up overlapping already mapped pages, which are discarded. Typically, if data was there with rw- protection, now the data is undefined and has rwx protection. Since Linux 4.17, the flag MAP_FIXED_NOREPLACE can be used to ensure that the fixed location is mapped atomically, preventing any clobbering. For earlier kernel, the call to mmap(2) will fall back to a random address, by not honoring the MAP_FIXED request at all. So callers should ensure that the returned address matches the requested one. Signed-off-by: Olivier Dion <odion@efficios.com>
- Loading branch information
Showing
3 changed files
with
20 additions
and
8 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
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