libunwind-devel
[Top][All Lists]
Advanced

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

[Libunwind-devel] [PATCH 16/17] ptrace: check for NULL arg.


From: Cody P Schafer
Subject: [Libunwind-devel] [PATCH 16/17] ptrace: check for NULL arg.
Date: Fri, 14 Sep 2012 17:12:01 -0700

tdep_get_func_addr in ppc64 passes NULL for the last argument of
as->access_mem.  tdep_get_func_addr is called by elf_w(lookup_symbol),
which in turn is called by elf_w(get_proc_name_in_image).

elf_w(get_proc_name_in_image) is part of the API, and is only passed an
unw_addr_space_t, not a unw_cursor_t, meaning that we cannot recover the
UPT_info on the PPC64 platform.

This could be fixed by giving libunwind the knowledge to perform
relocations itself, thus not needing to look at the running image to
determine function addresses.
---
 src/ptrace/_UPT_access_mem.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/ptrace/_UPT_access_mem.c b/src/ptrace/_UPT_access_mem.c
index b0c2ef0..918a8f9 100644
--- a/src/ptrace/_UPT_access_mem.c
+++ b/src/ptrace/_UPT_access_mem.c
@@ -32,6 +32,9 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, 
unw_word_t *val,
                 int write, void *arg)
 {
   struct UPT_info *ui = arg;
+  if (!ui)
+       return -UNW_EINVAL;
+
   pid_t pid = ui->pid;
 
   errno = 0;
@@ -65,6 +68,8 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, 
unw_word_t *val,
                 int write, void *arg)
 {
   struct UPT_info *ui = arg;
+  if (!ui)
+       return -UNW_EINVAL;
   pid_t pid = ui->pid;
   struct ptrace_io_desc iod;
 
-- 
1.7.11.3




reply via email to

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