History log of /external/libunwind/src/x86_64/Ginit.c
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
/external/libunwind/src/x86_64/Ginit.c
849a547fb4de698b95c14806ddb3fcad8aa26331 06-Jun-2015 Christopher Ferris <cferris@google.com> Attempt to read load_base from memory when needed.

When creating the map list, always try and read the load base
using the memory functions for local unwinds. For remote unwinds,
if we can't map in the elf image, then try and use the memory
functions instead.

Bug: 21381155
Change-Id: I28d0dbed585bbcd366a01d9313b463745059d737
/external/libunwind/src/x86_64/Ginit.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
/external/libunwind/src/x86_64/Ginit.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
/external/libunwind/src/x86_64/Ginit.c
16b95a68caaa7e021209e2cd6a877ae1e558f740 23-Jan-2014 Christopher Ferris <cferris@google.com> Add speed-ups to libunwind.

Add caching of /proc/self/maps data structures.

Add caching of elf image maps attached to the maps data structure.

Add a set of new map api functions to handle creation/destruction of the
maps by external code.

Remove the creation of the maps data structure in the local address space
init.

Change-Id: I0adae397d433fc3902f83a6f377f6889161937e5
/external/libunwind/src/x86_64/Ginit.c
cdf9ee587b78148c5d48dae1b5ea72ec8df64c96 23-Nov-2013 Christopher Ferris <cferris@google.com> Only check the map for local unwinds.

Change-Id: I7b7eed29a1b7ddad8e0d852598260809d3eb98d1
/external/libunwind/src/x86_64/Ginit.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
/external/libunwind/src/x86_64/Ginit.c
890e23eb9d3ffd9be2a025189a21794b5ed0e0ff 21-Sep-2012 Tommi Rantala <tt.rantala@gmail.com> Prefer NULL over zero
/external/libunwind/src/x86_64/Ginit.c
ae5c1f2adf4da04235d87d024d4d942c01b2b447 18-Apr-2011 Lassi Tuura <lat@cern.ch> Performance optimisations for fast trace.

Insert static branch prediction predicates in useful places and avoid
unnecessary code in the hottest paths. Bypass unnecessary indirect
calls, in particular to access_mem(), when known to be safe.
/external/libunwind/src/x86_64/Ginit.c
28f33c8ce0b654cf31d6beda9a612870662f3c56 22-Mar-2011 Lassi Tuura <lat@cern.ch> Auto-detect whether to use msync() or mincore() for address validation.
/external/libunwind/src/x86_64/Ginit.c
99e60be5a4c8bc9076d1b11e89a06f85d9da7b88 08-Jun-2010 Arun Sharma <arun@sharma-home.net> Fix the page boundary crossing bug.

Signed-off-by: Jason Evans <jasone@canonware.com>
/external/libunwind/src/x86_64/Ginit.c
58f290e1ce5950beac3767acbde08fcb0e1ca03f 21-Apr-2010 Konstantin Belousov <kostik@pooma.home> Add config.h.
/external/libunwind/src/x86_64/Ginit.c
2709abc88376efe80d7d5ef6d9d4e740d5c9afcb 21-Apr-2010 Konstantin Belousov <kostik@pooma.home> msync() also may be called on unaligned address.
/external/libunwind/src/x86_64/Ginit.c
44544132422ef87047490be3041da0bfebf27d69 21-Apr-2010 Konstantin Belousov <kostik@pooma.home> Account for possible unaligned access.
/external/libunwind/src/x86_64/Ginit.c
ee99dbec879212406d813b1bae56b988b4ab1e00 20-Apr-2010 Konstantin Belousov <kostikbel@gmail.com> Use mincore instead of msync when available
/external/libunwind/src/x86_64/Ginit.c
0dbeeeb08dc9a7e46281954e9225a84d4629a3db 05-Apr-2010 Konstantin Belousov <kostik@pooma.home> Move uc_addr to os-specific file
/external/libunwind/src/x86_64/Ginit.c
c7ffca11ae3b77343a9158ff5037cdf2e84136ae 06-Mar-2010 Konstantin Belousov <kostik@pooma.home> FreeBSD way to name registers.
/external/libunwind/src/x86_64/Ginit.c
3468a6b33d96549d1b01ef0c0fa42eb93fd3645d 23-Feb-2010 Arun Sharma <aruns@google.com> Change MS_SYNC to MS_ASYNC

Hopefully this makes the address validation a bit cheaper.
/external/libunwind/src/x86_64/Ginit.c
0cf76ed0b54f4b64d3a0575a1c85ef8617d4278d 01-Dec-2009 Paul Pluzhnikov <ppluzhnikov@google.com> 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.
/external/libunwind/src/x86_64/Ginit.c
649f1fb3449a65dd0626a709432d8b02a7c56bbc 16-Jun-2008 Arun Sharma <arun.sharma@google.com> [X86-64] For local unwinding, we have a defence mechanism against
bad/missing unwind information, which could result in libunwind
dereferencing bad pointers. This mechanism is based on msync(2) system
call and significantly reduces the chances of a bad pointer
dereference in libunwind.

The original idea was to turn this mechanism on only when necessary
i.e. libunwind didn't find proper unwind information for a IP.

There are a couple of problems in the current implementation.

* The flag is global and is modified without locking
* The flag isn't reset when starting a new unwind

The attached patch makes ->validate a per-thread setting by moving it
into struct cursor from unw_local_addr_space and resets it to false
when starting a new unwind. As a result, cursor->as_arg points to the
cursor itself instead of the ucontext (for the local case).

This was found to reduce the number of msync() system calls from an
application using libunwind significantly.

Signed-off-by: Paul Pluzhnikov <ppluzhnikov@google.com>
Signed-off-by: Arun Sharma <arun.sharma@google.com>
/external/libunwind/src/x86_64/Ginit.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.
/external/libunwind/src/x86_64/Ginit.c
62bacfcf1f889725c73fb0b8937365961a81801d 11-Aug-2006 David Mosberger-Tang <davidm@koala.localdomain> [x86-64] Minor reformatting for GNU-style and use memset() in lieu of bzero().
/external/libunwind/src/x86_64/Ginit.c
795529eee394ce1c0c80ee364217cdd679e5eda3 03-Aug-2006 Arun Sharma (अरुण) <arun.sharma@google.com> [x86-64] Add a known good address cache.

This improves the performance of Lperf-simple from 500ns to 195ns
on the avg.

Signed-off-by: Arun Sharma <arun.sharma@google.com>
/external/libunwind/src/x86_64/Ginit.c
527225e492553b997d16adca7cc3bb472d5ef628 27-Jul-2006 Arun Sharma <aruns@sharma.corp.google.com> [x86-64] Make a best effort at validating pointers before dereferencing them.

Signed-off-by: Arun Sharma <arun.sharma@google.com>
/external/libunwind/src/x86_64/Ginit.c
b1b84400b939ed346bfed08e9649433d6c9c86a2 03-May-2005 mostang.com!davidm <mostang.com!davidm> (tdep_uc_addr): Define as HIDDEN.

(Logical change 1.290)
/external/libunwind/src/x86_64/Ginit.c
a766efd844260866e0d216f6eeef87f4593f60b2 19-Aug-2004 ibm.com!masbock <ibm.com!masbock> (Logical change 1.249)
/external/libunwind/src/x86_64/Ginit.c
58e37267beb93d9ea5cb4da403f503a5aa4d842d 19-Aug-2004 ibm.com!masbock <ibm.com!masbock> Initial revision
/external/libunwind/src/x86_64/Ginit.c