On Tue, Dec 1, 2009 at 1:34 PM, Paul Pluzhnikov
<address@hidden> wrote:
Greetings,
This is rather on the obvious side.
While doing strace on an executable using libunwind, I noticed a
lot of:
msync(0, 1, MS_SYNC) = -1 ENOMEM (Cannot allocate memory)
Since we know that the first page isn't mapped (or at least doesn't
contain the data we are looking for), we can eliminate all such
msync calls.
Tested on Linux/x86_64 with no regressions.
Thanks,
--
Paul Pluzhnikov
diff --git a/src/x86/Ginit.c b/src/x86/Ginit.c
index e1b1dcf..2df94f0 100644
--- a/src/x86/Ginit.c
+++ b/src/x86/Ginit.c
@@ -117,6 +117,9 @@ validate_mem (unw_word_t addr)
addr = PAGE_START(addr);
+ if (addr == 0)
+ return -1;
+
for (i = 0; i < NLGA; i++)
{
if (last_good_addr[i] && (addr == last_good_addr[i]))
diff --git a/src/x86_64/Ginit.c b/src/x86_64/Ginit.c
index 031deaa..51d77c2 100644
--- a/src/x86_64/Ginit.c
+++ b/src/x86_64/Ginit.c
@@ -120,6 +120,9 @@ validate_mem (unw_word_t addr)
addr = PAGE_START(addr);
+ if (addr == 0)
+ return -1;
+
for (i = 0; i < NLGA; i++)
{
if (last_good_addr[i] && (addr == last_good_addr[i]))