This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB 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: [RFC 5/6] Introduce thread-safe way to handle SIGSEGV


On 3/9/19 9:22 AM, Tom Tromey wrote:
> The gdb demangler installs a SIGSEGV handler in order to protect gdb
> from demangler bugs.  However, this is not thread-safe, as signal
> handlers are global to the process.
> 
> This patch changes gdb to always install a global SIGSEGV handler, and
> then lets thread indicate their interest in handling the signal by
> setting a thread-local variable.
> 
> This patch then arranges for the demangler code to use this; being
> sure to arrange for calls to warning and the like to be done on the
> main thread.

The one downside of always having a handler is that the $_siginfo after
a "normal" sig11 in GDB won't be valid anymore (it will have SI_USER
set now instead and si_addr won't be valid, etc.).  We could "fix" this
by having signal frames supply $_siginfo though I'm not sure what
the most intuitive model of that would be.

-- 
John Baldwin


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