1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-04 17:09:25 +01:00
Commit graph

13 commits

Author SHA1 Message Date
Zachary T Welch
6a072982dd Fix file descriptor leakage in maps_init
If mmap fails, be sure to close the maps file before returning an error.

Signed-off-by: Zachary T Welch <zwelch@codesourcery.com>
Signed-off-by: Ken Werner <ken.werner@linaro.org>
2011-03-07 21:24:51 -08:00
Arun Sharma
5a1d3c6fd7 Remove bogus check on scan_string which is guaranteed to fail every time. 2010-02-21 22:35:26 -08:00
Paul Pluzhnikov
b56375e76a Reduce stack use and apply CONFIG_DEBUG_FRAME to more code.
Currently, libunwind allocates several PATH_MAX entries on stack, while
trying to find a binary via /proc/.../maps.

However stack space may be at premium (especially when sigaltstack is used),
and PATH_MAX on Linux is 4096, while SIGSTKSZ is only 8192 on x86.

Attached patch eliminates multiple PATH_MAX stack allocations, and simplifies
code in maps_next, at the cost of being unable to do anything if we can't
mmap one page. It appears to me that under such low-memory conditions,
libunwind will fail shortly elsewhere anyway.

This patch also disables more of debug_frame-handling code when
CONFIG_DEBUG_FRAME is undefined.

Tested on Linux/x86_64 with and without CONFIG_DEBUG_FRAME, no regressions.
2009-10-07 12:51:03 -07:00
Curt Wohlgemuth
253f3e5738 [Linux] Fix potentially overlapping memory-copy to use memmove() instead
of memcpy().
2007-10-18 10:45:55 -06:00
David Mosberger-Tang
03e05b4138 Fix two minor compiler-warnings. 2007-08-22 12:57:49 -06:00
David Mosberger-Tang
af2503e223 Fix bug in libunwind-ptrace which can cause reading of random data.
(maps_next): After reading less than a full buffer of data, copy
remaining data to the top of the buffer so as to maintain the
invariant that all data between mi->buf and mi->buf_end is valid.
This avoids maps_next() parsing uninitialized data.
2006-07-25 21:35:30 -06:00
hp.com!davidm
6c61288b9c (scan_dec): Don't skip over a character unless it's really a digit.
(scan_char): Don't skip over NUL terminator.

(Logical change 1.238)
2004-06-29 05:59:35 +00:00
mostang.com!davidm
2f210753bd (maps_init): Correct initialization of mi->buf.
(maps_close): Don't forget to unmap mi->buf if it's non-NULL.

(Logical change 1.209)
2004-04-21 07:24:35 +00:00
mostang.com!davidm
5de4b351e7 (struct map_iterator): Add members "buf_size", "buf", and "buf_end".
(maps_init): Try to mmap() a one-page buffer and, if successful,
	initialize the new map_iterator members based on it.
(maps_next): If the one-page buffer is available, use it to read
	/proc/PID/maps.  This avoids expensive lseek() calls which,
	in the case of /proc lead to T(n) = O(n^2) behavior.

(Logical change 1.208)
2004-04-21 03:56:06 +00:00
mostang.com!davidm
64c702cea7 (ltoa): New inline function.
(skip_whitespace): Likewise.
(scan_hex): Likewise.
(scan_dec): Likewise.
(scan_char): Likewise.
(scan_string): Likewise.
(maps_init): Avoid stdio operations since they're not async-signal
	safe.
(maps_next): Likewise.
(maps_close): Likewise.

(Logical change 1.199)
2004-03-31 07:38:06 +00:00
hp.com!davidm
cfded02a05 (maps_close): Do nothing if mi->fp is already NULL.
(Logical change 1.71)
2003-03-29 07:32:50 +00:00
mostang.com!davidm
824d6619b5 (Logical change 1.45) 2003-02-08 10:10:59 +00:00
mostang.com!davidm
5f94e2d488 Initial revision 2003-02-08 10:10:59 +00:00