libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH] arm: Expand memory validation


From: MyungJoo Ham
Subject: [Libunwind-devel] [PATCH] arm: Expand memory validation
Date: Mon, 28 Mar 2016 04:35:49 +0000 (GMT)

Prevent SIGSEGV for write as well as read.

Signed-off-by: MyungJoo Ham <address@hidden>
---
 src/arm/Ginit.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/arm/Ginit.c b/src/arm/Ginit.c
index 1ed3dbf..a23124d 100644
--- a/src/arm/Ginit.c
+++ b/src/arm/Ginit.c
@@ -126,6 +126,11 @@ static int
 access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
             void *arg)
 {
+  /* validate address */
+    const struct cursor *c = (const struct cursor *) arg;
+    if (c && validate_mem(addr))
+      return -1;
+
   if (write)
     {
       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
     {
-      /* validate address */
-      const struct cursor *c = (const struct cursor *) arg;
-      if (c && validate_mem(addr))
-        return -1;
-
       *val = *(unw_word_t *) addr;
       Debug (16, "mem[%x] -> %x\n", addr, *val);
     }
-- 
1.9.1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]