• Home
  • History
  • Annotate
  • only in /external/libunwind/src/ppc64/
History log of /external/libunwind/src/ppc64/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
18cf8168ef34750ffae6451bded31ff06d2d2763 29-Oct-2015 Christopher Ferris <cferris@google.com> Add a size when checking local reads/writes.

When doing a local unwind and checking whether a read or a write is valid,
the length of the read/write is not checked. This can lead to crashes if
attempting to read from within a map, but it would cross into out of the
map.

The fix is to check the size of the read/write.

Bug: 25371801
Change-Id: I52556cec06268ce3be5a6fb718147ba62c0a489f
init.c
ae38b20031a02d3f6f56a8315c1f097ae5293c56 04-May-2015 Christopher Ferris <cferris@google.com> Implement method to read elf data from memory.

I rewrote the entirety of elfxx.h/elfxx.c to support this.

For the rewrite, I modified the way that the symbol tables are searched.
The searched every single entry in the symbol table, and all symbol tables.
The new method finds the first entry that actually has a name and stops.

I also added some quick checks to make sure that a malformed elf would
not cause a crash when reading the symbol names from the symbol tables.

I had to implement the functionality of dwarf_find_unwind_table to handle
reading from memory, instead of from a file. I didn't implement debug frame
support since that likelihood of that appearing in memory seems low.

I also modified the dwarf_find_unwind_table to remove an abort and just
fail if that particular path is encountered. In addition, I added a quick
check to make sure that a malformed dynamic section doesn't cause a crash.

Bug: 19517541

Change-Id: I6075d87035dca41fa5e5dfcbe287a680a7671836
init.c
f4a8df5f4f338f1a12c25213227e98b34b42447f 08-Mar-2014 Christopher Ferris <cferris@google.com> Fix maps caching for local processes.

It is possible for the map to change while running libunwind. For example,
if lots of threads are doing local unwinds at the same time. Allow the
cached map to regenerate when it detects this case.

Included in this change is a refactor of all of the os code so that it can
also be used to do caching. This is a prelude to being able to attempt to
push the code upstream.

Also, this moves the code back closer to the original upstream code.
Hopefully, this will allow me to upstream all of these changes.

Change-Id: Ia219fa61e16e36416133bc95b1dd2161bd5b8ff7
init.c
cdf9ee587b78148c5d48dae1b5ea72ec8df64c96 23-Nov-2013 Christopher Ferris <cferris@google.com> Only check the map for local unwinds.

Change-Id: I7b7eed29a1b7ddad8e0d852598260809d3eb98d1
init.c
7d46a21e0a2cb561e4cad57b101a7137e01023dc 14-Nov-2013 Christopher Ferris <cferris@google.com> For current process, check memory accesses.

When attempting to unwind the current process, the library simple reads and
writes to memory for memory accesses. Unfortunately, if an unwind winds up
with invalid data, then the process can segfault. Add a guard to all memory
accesses that verifies that reads/writes are valid before attempting them.

For now, this guard is a nop on all systems except linux systems.

Also, modify the adjust_ip function to use the access_mem function
so that all reads go through the right function.

Bug: 11652982
Change-Id: I9d1feacae585374f6bf1d899f8a006ec9ecb47c4
init.c
efb75a0b84fed700173700a2e4fee153ba491b32 01-Oct-2013 Christopher Ferris <cferris@google.com> Update external/libunwind to build in android.

Bug: 8410085

Change-Id: Ideb46602d1e1cf2df5f858ef11d498055c02b969
nit.h
aebba1f8a7dee9b9ae3e70128ad48de69ca90b15 21-Sep-2012 Tommi Rantala <tt.rantala@gmail.com> Apply `define_lock()'

We have a nice macro for defining pthread mutexes, use it.
global.c
ee8df2628891435ebb95eee04668d5bbd6995723 19-Sep-2012 Tommi Rantala <tt.rantala@gmail.com> Constify `dwarf_to_unw_regnum_map'
global.c
ded94b98ff3534a3c394591f4b254b1af6f0711c 18-Sep-2012 Tommi Rantala <tt.rantala@gmail.com> Stop including `memory.h'

I am unable to find any reference to `memory.h' in the C99 and C11
committee drafts, so include `string.h' instead when we need memset() or
similar.
nwind_i.h
6023ccf6677fa030c001fcccc903c6ded9ffc47e 12-Sep-2012 Tommi Rantala <tt.rantala@gmail.com> PPC: remove unused `PAGE_START' macro from Ginit.c
init.c
5d0f376b08126b51a001d7cdfba1ec4e0d644f54 21-Sep-2012 Tommi Rantala <tt.rantala@gmail.com> Invert tdep_init() flag logic

Invert the flag that signals that tdep_init() was called, to move the
symbol from data to BSS.
global.c
f796a6dfe9a70de368c3434d3d3821e45a7ed130 15-Sep-2012 Cody P Schafer <cody@linux.vnet.ibm.com> ppc64: add FRAME_POINTER & NIP to regname.
egname.c
0abc36eb1884a9c6ebd3f7a655d2140fd31ed2fc 15-Sep-2012 Cody P Schafer <cody@linux.vnet.ibm.com> ppc64: be explicit in access_reg range check
init.c
8f94f1e6c01648ff41dec9b44bd7a8b6a230671e 23-Aug-2012 Tommi Rantala <tt.rantala@gmail.com> PPC: add missing debug level in Debug() calls in Gstep.c

ppc32/Gstep.c:116: warning: comparison between pointer and integer
ppc32/Gstep.c:116: warning: comparison with string literal results in unspecified behavior
ppc32/Gstep.c:116: warning: initialization makes integer from pointer without a cast
ppc32/Gstep.c:116: warning: passing argument 2 of 'fprintf' makes pointer from integer without a cast
/usr/powerpc-linux-gnu/include/stdio.h:333: note: expected 'const char *__restrict__' but argument is of type 'int'
step.c
54a096a5af6b5a9b57ac17a9485cd6069d3044af 01-Aug-2012 Tommi Rantala <tt.rantala@gmail.com> PPC: do not export dwarf_to_unw_regnum_map

dwarf_to_unw_regnum_map is internal to libunwind, and should not be
exported.
global.c
9e98f15e9aee12e67cd5956d06ccb559f6a06213 19-Mar-2011 Lassi Tuura <lat@iki.fi> Fast back-trace for x86_64 for only collecting the call stack.

Adds new function to perform a pure stack walk without unwinding,
functionally similar to backtrace() but accelerated by an address
attribute cache the caller maintains across calls.
nit.h
a9dce3c06e6ffcb83957e734d960505415118f00 25-Apr-2010 Lassi Tuura <lat@cern.ch> During the stack unwinding process, the return address points to
the instruction after the call for a normal frame. libunwind uses
IP-1 to lookup unwind information. However, this is not necessary for
interrupted frames such as signal frames (or interrupt frames) in
the kernel context.

This patch handles both cases correctly.

Based on work by Mark Wielaard <mwielaard@redhat.com>
nit.h
84d4150668d83a98420cc91e00026159c3d74a81 21-Sep-2009 Paul Pluzhnikov <ppluzhnikov@google.com> Allow caller to block signals.

Greetings,

We use libunwind just for stack traces (I suspect many others do as well).

The use pattern is:

GetStackTrace(void** result, int max_depth)
{
...
unw_getcontext(&uc);
unw_init_local(&cursor, &uc);

while (n < max_depth) {
if (unw_get_reg(&cursor, UNW_REG_IP, (unw_word_t *) &ip) < 0) {
break;
}
result[n++] = ip;
if (unw_step(&cursor) <= 0) {
break;
}
}

Given this usage, it is quite convenient for us to block signals (or
prevent signal handlers from re-entering libunwind by other means) at the
"top level", which makes most of the sigprocmask calls performed by
libunwind itself unneccessary.

The second patch in this series adds a configure option which removes most
of the sigprocmask calls.

Attached patch is a preliminary for it -- consolidating all of the
"sigprocmask; mutex_lock;" sequences into lock_acquire and "mutex_unlock;
sigprocmask;" sequences into lock_release.

Thanks,
--
Paul Pluzhnikov

commit 402d15b123d54a7669db7cf17a76dd315094e472
Author: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Mon Sep 21 10:18:28 2009 -0700

Replace "sigprocmask + mutext_lock" with a single lock_acquire.
Likewise, replace "mutext_unlock + sigprocmask" with lock_release.
global.c
57e569646368cb730f028ecf1732143474e3e642 01-Oct-2007 Jan Kratochvil <jan.kratochvil@redhat.com> Mark Wielaard <mwielaard@redhat.com> writes:

On some systems executable stacks are denied. Since libunwind and the
tests don't actually need executable stacks this patch marks all
assembly files as not needing it.

The original patch comes from frysk:

2007-04-05 Jan Kratochvil <jan.kratochvil@redhat.com>

* src/hppa/getcontext.S, src/hppa/setcontext.S, src/hppa/siglongjmp.S,
src/ia64/Ginstall_cursor.S, src/ia64/Linstall_cursor.S,
src/ia64/dyn_info_list.S, src/ia64/getcontext.S, src/ia64/longjmp.S,
src/ia64/setjmp.S, src/ia64/siglongjmp.S, src/ia64/sigsetjmp.S,
src/ppc64/longjmp.S, src/ppc64/siglongjmp.S, src/x86/longjmp.S,
src/x86/siglongjmp.S, src/x86_64/longjmp.S, src/x86_64/setcontext.S,
src/x86_64/siglongjmp.S: Stack should be non-executable, for SELinux.

I added a couple more markers for new files in current libunwind.

Before this patch you would get the following on selinux enabled
systems without allow_exec_stack: error while loading shared
libraries:

libunwind.so.7: cannot enable executable stack as shared object
requires: Permission denied

After the patch that error disappears and all test results are similar
to the results on systems without executable stack protection.
etcontext.S
4499bb29a6214b5df5b3b21e03c6b4f3c8f26cfd 13-Sep-2007 Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> [PPC32] First check-in to add preliminary support for Linux/PPC32.
create_addr_space.c
get_proc_info.c
get_save_loc.c
init_local.c
init_remote.c
is_signal_frame.c
step.c
create_addr_space.c
get_proc_info.c
get_save_loc.c
init_local.c
init_remote.c
is_signal_frame.c
ake-arch.in
nit.h
ongjmp.S
iglongjmp.S
32e2187fab8d7a0adaa099b7bdaefca50628de88 27-Aug-2007 Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> [PPC64] Get "make check" to work on PPC64 Linux. Add a README entry
describing the expected results.
iglongjmp.S
3e24581adca378307322555d2b5e70439dbc9c19 24-Aug-2007 Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> [PPC64] Add PPC64 entry to README and fix David's typo in ppc64/get_func_addr.c
et_func_addr.c
e6b9f350f78ecd9ef3b8a3e721f9435c94fc2562 22-Aug-2007 David Mosberger-Tang <davidm@panda.mostang.com> Introduce a tdep_get_func_addr_hook() in the ELF lookup_symbol()
routine and add address-space argument. This is needed because on
PPC64, a the function-name symbol refers to a function descriptor
(unlike, for example, on ia64, where the @fptr() operator is needed to
refer to a function descriptor). Thus, in order to look up the name
of a function, we need to dereference the function descriptor. To
make matters more "interesting", the function descriptors are normally
resolved by the dynamic linker, so we can't get their values from the
ELF file. Instead, we have to read them from the running image, hence
the need for the address-space argument.
init.c
et_func_addr.c
b33021e4b2f3a92141c01eb24b98bc51a97c498d 02-Aug-2007 Jose Flavio Aguilar Paulino <jflavio@br.ibm.com> Add PPC64 support.
create_addr_space.c
get_proc_info.c
get_save_loc.c
global.c
init.c
init_local.c
init_remote.c
is_signal_frame.c
regs.c
resume.c
step.c
create_addr_space.c
get_proc_info.c
get_save_loc.c
global.c
init.c
init_local.c
init_remote.c
is_signal_frame.c
regs.c
resume.c
step.c
ake-arch.in
nit.h
s_fpreg.c
ongjmp.S
egname.c
etcontext.S
iglongjmp.S
context_i.h
nwind_i.h