Signals and Solaris

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

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
ucontext->uc_link.

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 http://paste.lisp.org/display/139777 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