Commit 8a6830df authored by Matthew Dempsky's avatar Matthew Dempsky Committed by Commit Bot

Prepare for non-executable VMOs

Fuchsia VMOs will be non-executable by default in the future (SEC-42),
so we'll need to use zx_vmo_replace_as_executable to make it possible
to map them into memory as executable. And in the mean time, this call
is a no-op.

SEC-42
TBR: mlippautz

Change-Id: I4521559b163519ded4afa6b55e99f983e38b1de5
Reviewed-on: https://chromium-review.googlesource.com/c/1281824Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarWez <wez@chromium.org>
Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58804}
parent db1739b6
......@@ -57,6 +57,11 @@ void* OS::Allocate(void* address, size_t size, size_t alignment,
strlen(kVirtualMemoryName));
uintptr_t reservation;
uint32_t prot = GetProtectionFromMemoryPermission(access);
if ((prot & ZX_VM_FLAG_PERM_EXECUTE) != 0) {
if (zx_vmo_replace_as_executable(vmo, ZX_HANDLE_INVALID, &vmo) != ZX_OK) {
return nullptr;
}
}
zx_status_t status = zx_vmar_map(zx_vmar_root_self(), prot, 0, vmo, 0,
request_size, &reservation);
// Either the vmo is now referenced by the vmar, or we failed and are bailing,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment