Bug 10857 - dwarf unwinder doesn't handle call frame instructions taking expressions
Summary: dwarf unwinder doesn't handle call frame instructions taking expressions
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: runtime (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
: 11898 (view as bug list)
Depends on:
Blocks: 11898
  Show dependency treegraph
 
Reported: 2009-10-28 13:27 UTC by Mark Wielaard
Modified: 2011-05-30 20:39 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Wielaard 2009-10-28 13:27:18 UTC
The runtime dwarf unwinder doesn't handle DW_CFA_def_cfa_expression,
DW_CFA_expression and DW_CFA_val_expression which handle values defined as dwarf
operations. The unwinder fails in such cases and we need to fall back to raw
stack walking.

It would be nice to reuse some of the loc2c code for this so we are able to kind
of precompile the operations. That would also benefit from the (stack depth)
limits already in place in loc2c (but note that not all dwarf expressions are
allowed in the call frame information). It isn't clear how to do this simply.
Comment 1 Frank Ch. Eigler 2010-05-06 13:17:23 UTC
Have such expressions been seen in the wild?
Comment 2 Roland McGrath 2010-05-07 01:32:22 UTC
If "in the wild" means do they actually appear in real binaries, the answer is
yes.  If you mean "has it hampered some unwinding some systemtap user tried",
then who knows.

pmachata recently did some scripted CFI analysis on a large raft of OS binaries,
which cited the subset of these cases where a recently-fixed gcc bug was
involved.  It would be simpler to script grepping for all DW_CFA_expression,
DW_CFA_def_cfa_expression, and DW_CFA_val_expression uses.

GCC can emit DW_CFA_expression and DW_CFA_def_cfa_expression for x86 and perhaps
other machines.  Without doing the aforementioned grepping, off hand we have
only noticed it being used in x86-32 code generation so far.

glibc uses those in the signal frame on x86_64, and uses DW_CFA_val_expression
in its locking code (used both inside glibc and for libpthread) for x86_64 and i386.
Comment 3 Frank Ch. Eigler 2010-08-16 18:28:34 UTC
*** Bug 11898 has been marked as a duplicate of this bug. ***
Comment 4 Frank Ch. Eigler 2010-10-06 19:09:55 UTC
See test case in bug #11898.
Comment 5 Roland McGrath 2010-10-08 21:52:24 UTC
commit d3ddec6 improves that test case.  It still needs more thorough testing, and cases in the testsuite.
Comment 6 Frank Ch. Eigler 2011-05-30 20:39:12 UTC
committed, and included security bug was later fixed.