mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-12-23 12:03:41 +01: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:
parent
9626d66019
commit
0cf76ed0b5
2 changed files with 6 additions and 0 deletions
|
@ -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]))
|
||||
|
|
|
@ -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]))
|
||||
|
|
Loading…
Reference in a new issue