Skip to content

Despite dual mapping the VM is still flipping page protection bits on executable pages #37739

Closed
@mkustermann

Description

@mkustermann

Despite the fact that the VM can run with dual mapping enabled, we still seem to flip page protection bits on the executable pages in GC related code.

For example runtime/vm/heap/pages.cc:

HeapPage* PageSpace::AllocatePage(HeapPage::PageType type, bool link) {
    ...
      if (exec_pages_ == NULL) {
        exec_pages_ = page;
      } else {
        if (FLAG_write_protect_code) {
          exec_pages_tail_->WriteProtect(false);
        }
        exec_pages_tail_->set_next(page);
        if (FLAG_write_protect_code) {
          exec_pages_tail_->WriteProtect(true);
        }
    ...
}

The GC should use the RW mapping for performing these writes instead of flipping the protection on the RX mapping (which is more expensive due to performing syscalls).

/cc @rmacnak-google @crelier

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-vmUse area-vm for VM related issues, including code coverage, and the AOT and JIT backends.vm-gcRelated to the VM's garbage collector

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions