summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShutterQuick <shutter@canternet.org>2018-02-09 16:41:54 +0100
committerDave Watson <davejwatson@fb.com>2018-02-09 07:41:54 -0800
commit05d814b64036b1ea2f0f328b3a985b03559dcf10 (patch)
tree11709d16b0f3efcf44771a44dc6a737677de13a8
parent7d6cc6696ab8a808da3dbe23ca2493ddf2799b56 (diff)
downloadlibunwind-05d814b64036b1ea2f0f328b3a985b03559dcf10.tar.gz
Don't check if the memory is in core (#64)
libunwind uses mincore() to validate that memory is mapped and available to the process. For this purpose, checking the return value of mincore() is sufficient. The result array tells us if the kernel has swapped out the page or not. We don't care about this, and the check leads to failure in those cases where the kernel has swapped out the page.
-rw-r--r--src/x86_64/Ginit.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
index 2a84a1ee..b7e8e462 100644
--- a/src/x86_64/Ginit.c
+++ b/src/x86_64/Ginit.c
@@ -140,11 +140,6 @@ static int mincore_validate (void *addr, size_t len)
return -1;
}
- for (i = 0; i < (len + PAGE_SIZE - 1) / PAGE_SIZE; i++)
- {
- if (!(mvec[i] & 1)) return -1;
- }
-
return write_validate (addr);
}
#endif
@@ -165,7 +160,7 @@ tdep_init_mem_validate (void)
int ret;
while ((ret = mincore ((void*)addr, PAGE_SIZE, mvec)) == -1 &&
errno == EAGAIN) {}
- if (ret == 0 && (mvec[0] & 1))
+ if (ret == 0)
{
Debug(1, "using mincore to validate memory\n");
mem_validate_func = mincore_validate;