Commit afdd08ac authored by Wez's avatar Wez Committed by Commit Bot

[Fuchsia] Use the read/write permission flag names when mapping VMOs.

The ZX_VM_FLAG_PERM_* names have been deprecated in favour of the
ZX_VM_PERM_* form, and will shortly be removed from the Fuchsia SDK.

Bug: chromium:925597
Change-Id: Ic05912cbf9758915e1bc97c41c682aee028a3b5d
Reviewed-on: https://chromium-review.googlesource.com/c/1437817Reviewed-by: 's avatarAdam Klein <adamk@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#59138}
parent faae9fe6
......@@ -20,14 +20,13 @@ uint32_t GetProtectionFromMemoryPermission(OS::MemoryPermission access) {
case OS::MemoryPermission::kNoAccess:
return 0; // no permissions
case OS::MemoryPermission::kRead:
return ZX_VM_FLAG_PERM_READ;
return ZX_VM_PERM_READ;
case OS::MemoryPermission::kReadWrite:
return ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE;
return ZX_VM_PERM_READ | ZX_VM_PERM_WRITE;
case OS::MemoryPermission::kReadWriteExecute:
return ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE |
ZX_VM_FLAG_PERM_EXECUTE;
return ZX_VM_PERM_READ | ZX_VM_PERM_WRITE | ZX_VM_PERM_EXECUTE;
case OS::MemoryPermission::kReadExecute:
return ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_EXECUTE;
return ZX_VM_PERM_READ | ZX_VM_PERM_EXECUTE;
}
UNREACHABLE();
}
......@@ -57,7 +56,7 @@ 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 ((prot & ZX_VM_PERM_EXECUTE) != 0) {
if (zx_vmo_replace_as_executable(vmo, ZX_HANDLE_INVALID, &vmo) != ZX_OK) {
return nullptr;
}
......
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