@@ -3023,14 +3023,14 @@ void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
30233023 }
30243024}
30253025
3026- void os::pd_free_memory (char *addr, size_t bytes, size_t alignment_hint, MEMFLAGS flag ) {
3026+ void os::pd_free_memory (char *addr, size_t bytes, size_t alignment_hint) {
30273027 // This method works by doing an mmap over an existing mmaping and effectively discarding
30283028 // the existing pages. However it won't work for SHM-based large pages that cannot be
30293029 // uncommitted at all. We don't do anything in this case to avoid creating a segment with
30303030 // small pages on top of the SHM segment. This method always works for small pages, so we
30313031 // allow that in any case.
30323032 if (alignment_hint <= os::vm_page_size () || can_commit_large_page_memory ()) {
3033- commit_memory (addr, bytes, alignment_hint, !ExecMem, flag );
3033+ commit_memory (addr, bytes, alignment_hint, !ExecMem);
30343034 }
30353035}
30363036
@@ -3637,7 +3637,7 @@ bool os::pd_create_stack_guard_pages(char* addr, size_t size) {
36373637 }
36383638 }
36393639
3640- return os::commit_memory (addr, size, !ExecMem, mtThreadStack );
3640+ return os::commit_memory (addr, size, !ExecMem);
36413641}
36423642
36433643// If this is a growable mapping, remove the guard pages entirely by
@@ -3653,7 +3653,7 @@ bool os::remove_stack_guard_pages(char* addr, size_t size) {
36533653 return ::munmap (addr, size) == 0 ;
36543654 }
36553655
3656- return os::uncommit_memory (addr, size, !ExecMem, mtThreadStack );
3656+ return os::uncommit_memory (addr, size);
36573657}
36583658
36593659// 'requested_addr' is only treated as a hint, the return value may or
@@ -3757,7 +3757,7 @@ static int anon_munmap(char * addr, size_t size) {
37573757 return 1 ;
37583758}
37593759
3760- char * os::pd_reserve_memory (size_t bytes, bool exec, MEMFLAGS flag ) {
3760+ char * os::pd_reserve_memory (size_t bytes, bool exec) {
37613761 return anon_mmap (nullptr , bytes);
37623762}
37633763
@@ -4214,7 +4214,7 @@ static char* reserve_memory_special_huge_tlbfs(size_t bytes,
42144214}
42154215
42164216char * os::pd_reserve_memory_special (size_t bytes, size_t alignment, size_t page_size,
4217- char * req_addr, bool exec, MEMFLAGS flag ) {
4217+ char * req_addr, bool exec) {
42184218 assert (UseLargePages, " only for large pages" );
42194219
42204220 char * const addr = reserve_memory_special_huge_tlbfs (bytes, alignment, page_size, req_addr, exec);
@@ -4249,9 +4249,9 @@ bool os::can_commit_large_page_memory() {
42494249 return UseTransparentHugePages;
42504250}
42514251
4252- char * os::pd_attempt_map_memory_to_file_at (char * requested_addr, size_t bytes, int file_desc, MEMFLAGS flag ) {
4252+ char * os::pd_attempt_map_memory_to_file_at (char * requested_addr, size_t bytes, int file_desc) {
42534253 assert (file_desc >= 0 , " file_desc is not valid" );
4254- char * result = pd_attempt_reserve_memory_at (requested_addr, bytes, !ExecMem, flag );
4254+ char * result = pd_attempt_reserve_memory_at (requested_addr, bytes, !ExecMem);
42554255 if (result != nullptr ) {
42564256 if (replace_existing_mapping_with_file_mapping (result, bytes, file_desc) == nullptr ) {
42574257 vm_exit_during_initialization (err_msg (" Error in mapping Java heap at the given filesystem directory" ));
@@ -4263,7 +4263,7 @@ char* os::pd_attempt_map_memory_to_file_at(char* requested_addr, size_t bytes, i
42634263// Reserve memory at an arbitrary address, only if that area is
42644264// available (and not reserved for something else).
42654265
4266- char * os::pd_attempt_reserve_memory_at (char * requested_addr, size_t bytes, bool exec, MEMFLAGS flag ) {
4266+ char * os::pd_attempt_reserve_memory_at (char * requested_addr, size_t bytes, bool exec) {
42674267 // Assert only that the size is a multiple of the page size, since
42684268 // that's all that mmap requires, and since that's all we really know
42694269 // about at this low abstraction level. If we need higher alignment,
@@ -4655,21 +4655,23 @@ static void workaround_expand_exec_shield_cs_limit() {
46554655 */
46564656 char * hint = (char *)(os::Linux::initial_thread_stack_bottom () -
46574657 (StackOverflow::stack_guard_zone_size () + page_size));
4658- char * codebuf = os::attempt_reserve_memory_at (hint, page_size, !ExecMem, mtInternal );
4658+ char * codebuf = os::attempt_reserve_memory_at (hint, page_size);
46594659
46604660 if (codebuf == nullptr ) {
46614661 // JDK-8197429: There may be a stack gap of one megabyte between
46624662 // the limit of the stack and the nearest memory region: this is a
46634663 // Linux kernel workaround for CVE-2017-1000364. If we failed to
46644664 // map our codebuf, try again at an address one megabyte lower.
46654665 hint -= 1 * M;
4666- codebuf = os::attempt_reserve_memory_at (hint, page_size, !ExecMem, mtInternal );
4666+ codebuf = os::attempt_reserve_memory_at (hint, page_size);
46674667 }
46684668
4669- if ((codebuf == nullptr ) || (!os::commit_memory (codebuf, page_size, ExecMem, mtInternal ))) {
4669+ if ((codebuf == nullptr ) || (!os::commit_memory (codebuf, page_size, true ))) {
46704670 return ; // No matter, we tried, best effort.
46714671 }
46724672
4673+ MemTracker::record_virtual_memory_type ((address)codebuf, mtInternal);
4674+
46734675 log_info (os)(" [CS limit NX emulation work-around, exec code at: %p]" , codebuf);
46744676
46754677 // Some code to exec: the 'ret' instruction
0 commit comments