libunwind/Don-t-check-if-the-memory-is-in-core-64.patch
2019-09-30 10:58:37 -04:00

43 lines
1.3 KiB
Diff

From 05d814b64036b1ea2f0f328b3a985b03559dcf10 Mon Sep 17 00:00:00 2001
From: ShutterQuick <shutter@canternet.org>
Date: Fri, 9 Feb 2018 16:41:54 +0100
Subject: [PATCH 10/50] 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.
---
src/x86_64/Ginit.c | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
index 2a84a1e..b7e8e46 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;
--
1.8.3.1