aboutsummaryrefslogtreecommitdiffstats
path: root/executor/common_fuchsia.h
diff options
context:
space:
mode:
authorJulia Hansbrough <flowerhack@google.com>2019-02-26 23:57:48 -0800
committerDmitry Vyukov <dvyukov@google.com>2019-02-27 08:57:48 +0100
commit083cfd0e4a471c4f76d872ce6b521e6443246b3a (patch)
tree5914626e9461481599ccaac75e9a4649a8391687 /executor/common_fuchsia.h
parentf2468c12ea2d551341d660b1b3fc2e5c1c280355 (diff)
executor: update syntax for making W+X fuchsia memory
Fuchsia recently changed such that zx_vmar_map can't be declared executable and writeable at the same time; use a new syscall for this purpose. Also made a few errors more informative.
Diffstat (limited to 'executor/common_fuchsia.h')
-rw-r--r--executor/common_fuchsia.h6
1 files changed, 5 insertions, 1 deletions
diff --git a/executor/common_fuchsia.h b/executor/common_fuchsia.h
index b40120b1c..a049bd17d 100644
--- a/executor/common_fuchsia.h
+++ b/executor/common_fuchsia.h
@@ -176,12 +176,16 @@ long syz_mmap(size_t addr, size_t size)
fail("zx_object_get_info(ZX_INFO_VMAR) failed: %d", status);
zx_handle_t vmo;
status = zx_vmo_create(size, 0, &vmo);
+ if (status != ZX_OK) {
+ debug("zx_vmo_create failed with: %d", status);
+ return status;
+ }
+ status = zx_vmo_replace_as_executable(vmo, ZX_HANDLE_INVALID, &vmo);
if (status != ZX_OK)
return status;
uintptr_t mapped_addr;
status = zx_vmar_map(root, ZX_VM_FLAG_SPECIFIC_OVERWRITE | ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE | ZX_VM_FLAG_PERM_EXECUTE,
addr - info.base, vmo, 0, size,
-
&mapped_addr);
return status;
}