diff options
| author | Julia Hansbrough <flowerhack@google.com> | 2019-02-26 23:57:48 -0800 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2019-02-27 08:57:48 +0100 |
| commit | 083cfd0e4a471c4f76d872ce6b521e6443246b3a (patch) | |
| tree | 5914626e9461481599ccaac75e9a4649a8391687 /executor | |
| parent | f2468c12ea2d551341d660b1b3fc2e5c1c280355 (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')
| -rw-r--r-- | executor/common_fuchsia.h | 6 | ||||
| -rw-r--r-- | executor/executor_fuchsia.h | 5 |
2 files changed, 8 insertions, 3 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; } diff --git a/executor/executor_fuchsia.h b/executor/executor_fuchsia.h index ebd4f678d..0703a07dc 100644 --- a/executor/executor_fuchsia.h +++ b/executor/executor_fuchsia.h @@ -12,8 +12,9 @@ static void os_init(int argc, char** argv, void* data, size_t data_size) { - if (syz_mmap((size_t)data, data_size) != ZX_OK) - fail("mmap of data segment failed"); + zx_status_t status = syz_mmap((size_t)data, data_size); + if (status != ZX_OK) + fail("mmap of data segment failed with: %d", status); } static long execute_syscall(const call_t* c, long a[kMaxArgs]) |
