This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Avoid deadlock in malloc on backtrace


On 02/24/2015 03:51 AM, Siddhesh Poyarekar wrote:
dynamically loading the library requires malloc

How about dynamically linking _Unwind_Backtrace etc. at startup, rather than doing it lazily after heap memory may been corrupted and one really needs the backtrace?

It is news to me that 'backtrace' can call 'malloc' the first time that one uses 'backtrace'. Now that I know this, I suppose I should modify Emacs to do a no-op call to 'backtrace' first thing, before Emacs does anything important. That way, when Emacs really needs to call 'backtrace' due to a bad pointer or whatever, we'll have more confidence that the call to 'backtrace' will actually work.

But really, we shouldn't have to modify applications to work around this problem, and the problem should be fixed in glibc. 'backtrace' shouldn't require 'malloc' to work, as we want 'backtrace' to get a backtrace as reliably as possible even when part of memory is corrupted.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]