mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-03-13 03:30:08 +01:00
arm: Expand memory validation
Prevent SIGSEGV for write as well as read. Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
This commit is contained in:
parent
3b3a453a65
commit
74d7cd9898
1 changed files with 5 additions and 5 deletions
|
@ -126,6 +126,11 @@ static int
|
||||||
access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
|
access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
|
||||||
void *arg)
|
void *arg)
|
||||||
{
|
{
|
||||||
|
/* validate address */
|
||||||
|
const struct cursor *c = (const struct cursor *) arg;
|
||||||
|
if (c && validate_mem(addr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
if (write)
|
if (write)
|
||||||
{
|
{
|
||||||
Debug (16, "mem[%x] <- %x\n", addr, *val);
|
Debug (16, "mem[%x] <- %x\n", addr, *val);
|
||||||
|
@ -133,11 +138,6 @@ access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* validate address */
|
|
||||||
const struct cursor *c = (const struct cursor *) arg;
|
|
||||||
if (c && validate_mem(addr))
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
*val = *(unw_word_t *) addr;
|
*val = *(unw_word_t *) addr;
|
||||||
Debug (16, "mem[%x] -> %x\n", addr, *val);
|
Debug (16, "mem[%x] -> %x\n", addr, *val);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue