1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-09-27 17:09:29 +02:00

Check for NULL when validating addresses

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.
This commit is contained in:
Paul Pluzhnikov 2009-12-01 13:59:45 -08:00 committed by Arun Sharma
parent 9626d66019
commit 0cf76ed0b5
2 changed files with 6 additions and 0 deletions

View file

@ -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]))

View file

@ -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]))