Signals and Solaris

Bug #1248181 reported by Stas Boukarev on 2013-11-05
This bug affects 1 person
Affects Status Importance Assigned to Milestone

Bug Description

Solaris (both SPARC and x86) can present signal handlers with a
wrong ucontext_t structure when receiving more than one signal at a
time. The correct structure can be found by following

This presents particular problems on SPARC, because it uses a trap to
signal that it needs to call a C allocation routine, and it uses the
preceding OR instruction to encode the arguments. Running sb-sprof and
consing at the same time is bound to make the allocation trap handler
to receive bad ucontext.

The C test in replicates that result.

I was able to get sb-sprof running by following uc_link and comparing
the value of PC register with siginfo->si_addr, if it matches, that's
the current context.

But this is extremely fishy, I haven't found any documentation saying
what is the correct thing to do. And some signal handler receive NULL
as siginfo, so there's nothing to compare against.

Potentially, any usage of context on Solaris is susceptible to this
problem (or even on other OSes).

Attached is the patch which make sb-sprof work.

Stas Boukarev (stassats) wrote :
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers