aboutsummaryrefslogtreecommitdiffstats
path: root/executor/executor_test.h
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2022-10-21 09:56:39 +0200
committerDmitry Vyukov <dvyukov@google.com>2022-10-21 11:46:50 +0200
commitb960f108b3f88019e196293e2d507a9bf9d0e132 (patch)
tree2ca793251733f1877ebc4d418fe4c143dfcdefc5 /executor/executor_test.h
parent63e790dd3617b22ee48ea791ee759e27ac140bbf (diff)
executor: better errors for failed mmaps
A fixed-address mmap can fail completely or return a different address. Log what it was. Based on: https://groups.google.com/g/syzkaller/c/lto00RwlDIQ
Diffstat (limited to 'executor/executor_test.h')
-rw-r--r--executor/executor_test.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/executor/executor_test.h b/executor/executor_test.h
index 5984fc8f1..fb9b28add 100644
--- a/executor/executor_test.h
+++ b/executor/executor_test.h
@@ -9,8 +9,9 @@
static void os_init(int argc, char** argv, void* data, size_t data_size)
{
- if (mmap(data, data_size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0) != data)
- fail("mmap of data segment failed");
+ void* got = mmap(data, data_size, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE | MAP_FIXED, -1, 0);
+ if (data != got)
+ failmsg("mmap of data segment failed", "want %p, got %p", data, got);
}
static intptr_t execute_syscall(const call_t* c, intptr_t a[kMaxArgs])