[fuchsia] Ensure VMO has execute rights
Currently VMOs on Fuchsia are allocated with execute rights, but soon
that will not be the case, so the calls later to re-map memory as
executable will fail. Add zx_vmo_replace_as_executable call to ensure
they don't.
Change-Id: I45c5f5527bc36ed898b29095788006239bb2b0b3
Reviewed-on: https://swiftshader-review.googlesource.com/c/24188
Reviewed-by: Wez <wez@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
Tested-by: Matthew Dempsky <mdempsky@google.com>
diff --git a/src/Reactor/ExecutableMemory.cpp b/src/Reactor/ExecutableMemory.cpp
index 68fc51b..67d84ea 100644
--- a/src/Reactor/ExecutableMemory.cpp
+++ b/src/Reactor/ExecutableMemory.cpp
@@ -214,6 +214,9 @@
if (zx_vmo_create(length, ZX_VMO_NON_RESIZABLE, &vmo) != ZX_OK) {
return nullptr;
}
+ if (zx_vmo_replace_as_executable(vmo, ZX_HANDLE_INVALID, &vmo) != ZX_OK) {
+ return nullptr;
+ }
zx_vaddr_t reservation;
zx_status_t status = zx_vmar_map(
zx_vmar_root_self(), ZX_VM_PERM_READ | ZX_VM_PERM_WRITE,