skip to main content
research-article
Open access

Reliable and fast DWARF-based stack unwinding

Published: 10 October 2019 Publication History

Abstract

Debug information, usually encoded in the DWARF format, is a hidden and obscure component of our computing infrastructure. Debug information is obviously used by debuggers, but it also plays a key role in program analysis tools, and, most surprisingly, it can be relied upon by the runtime of high-level programming languages. For instance the C++ runtime leverages DWARF stack unwind tables to implement exceptions! Alas, generating debug information adds significant burden to compiler implementations, and the debug information itself can be pervaded by subtle bugs, making the whole infrastructure unreliable. Additionally, interpreting the debug tables is a time-consuming task and, for some applications as sampling profilers, it turns out to be a performance bottleneck.
In this paper we focus on the DWARF .eh_frame table, that enables stack unwinding in absence of frame-pointers. We will describe two techniques to perform validation and synthesis of the DWARF stack unwinding tables, and their implementation for the x86_64 architecture. The validation tool has proven effective for compiler and inline assembly testing, while the synthesis tool can generate DWARF unwind tables for arbitrary binaries lacking debug information. Additionally, we report on a technique to precompile unwind tables into native x86_64 code, which we have implemented and integrated into libunwind, resulting in 11x-25x DWARF-based unwind speedups.

Supplementary Material

a146-bastian (a146-bastian.webm)
Presentation at OOPSLA '19

References

[1]
J. Baker, A. Cunei, T. Kalibera, F. Pizlo, and J. Vitek. 2009. Accurate Garbage Collection in Uncooperative Environments Revisited. Concurr. Comput. : Pract. Exper. 21, 12 (Aug. 2009), 1572–1606.
[2]
Eli Bendersky. 2019. pyelftools. https://github.com/eliben/pyelftools
[3]
David Brumley, Ivan Jager, Thanassis Avgerinos, and Edward J. Schwartz. 2011. BAP: A Binary Analysis Platform. In Computer Aided Verification - 23rd International Conference, CAV 2011, Snowbird, UT, USA, July 14-20, 2011. Proceedings. 463–469.
[4]
Cristina Cifuentes. 1994. Reverse compilation techniques. Ph.D. Dissertation. Queensland University of Technology. https: //eprints.qut.edu.au/36820/
[5]
Jonathan Corbet. 2017. The ORCs are coming. LWN.net (2017). https://lwn.net/Articles/728339/
[6]
DWARF. 2017. DWARF Debugging Information Format version 5. DWARF Debugging Information Format Committee. http://dwarfstd.org
[7]
Anonymous Google Engineer. 2018. Personal communication.
[8]
Jingxuan He, Pesho Ivanov, Petar Tsankov, Veselin Raychev, and Martin Vechev. 2018. Debin: Predicting Debug Information in Stripped Binaries. In Proceedings of the 2018 ACM SIGSAC Conference on Computer and Communications Security (CCS ’18). ACM, New York, NY, USA, 1667–1680.
[9]
Fergus Henderson. 2002. Accurate Garbage Collection in an Uncooperative Environment. In Proceedings of the 3rd International Symposium on Memory Management (ISMM ’02). ACM, New York, NY, USA, 150–156.
[10]
Stephen Kell. 2015. Towards a Dynamic Object Model Within Unix Processes. In 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!) (Onward! 2015). ACM, New York, NY, USA, 224–239.
[11]
James Oakley and Sergey Bratus. 2011. Exploiting the Hard-Working DWARF: Trojan and Exploit Techniques with No Native Executable Code. In 5th USENIX Workshop on Offensive Technologies, WOOT’11, August 8, 2011, San Francisco, CA, USA, Proceedings. 91–102. http://static.usenix.org/event/woot11/tech/final_files/Oakley.pdf
[12]
John Regehr, Yang Chen, Pascal Cuoq, Eric Eide, Chucky Ellison, and Xuejun Yang. 2012. Test-case Reduction for C Compiler Bugs. In Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’12). ACM, New York, NY, USA, 335–346.
[13]
Fridtjof Siebert. 2001. Constant-Time Root Scanning for Deterministic Garbage Collection. In Proceedings of the 10th International Conference on Compiler Construction (CC ’01). Springer-Verlag, London, UK, UK, 304–318. http://dl.acm. org/citation.cfm?id=647477.727769
[14]
Xuejun Yang, Yang Chen, Eric Eide, and John Regehr. 2011. Finding and understanding bugs in C compilers. In Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2011, San Jose, CA, USA, June 4-8, 2011. 283–294.
[15]
Yanmin Zhang. 2008. Hackbench. https://people.redhat.com/mingo/cfs-scheduler/tools/hackbench.c

Cited By

View all
  • (2024)Source-Level Debugging of Compiler-Optimised Code: Ill-Posed, but Not ImpossibleProceedings of the 2024 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3689492.3690047(38-53)Online publication date: 17-Oct-2024
  • (2022)Low overhead and context sensitive profiling of GPU-accelerated applicationsProceedings of the 36th ACM International Conference on Supercomputing10.1145/3524059.3532388(1-13)Online publication date: 28-Jun-2022
  • (2021)StackBERTProceedings of the 14th ACM Workshop on Artificial Intelligence and Security10.1145/3474369.3486865(85-95)Online publication date: 15-Nov-2021
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Proceedings of the ACM on Programming Languages
Proceedings of the ACM on Programming Languages  Volume 3, Issue OOPSLA
October 2019
2077 pages
EISSN:2475-1421
DOI:10.1145/3366395
Issue’s Table of Contents
This work is licensed under a Creative Commons Attribution International 4.0 License.

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 10 October 2019
Published in PACMPL Volume 3, Issue OOPSLA

Permissions

Request permissions for this article.

Check for updates

Badges

Author Tags

  1. DWARF
  2. debugging
  3. stack unwinding

Qualifiers

  • Research-article

Funding Sources

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)1,217
  • Downloads (Last 6 weeks)114
Reflects downloads up to 23 Oct 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Source-Level Debugging of Compiler-Optimised Code: Ill-Posed, but Not ImpossibleProceedings of the 2024 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3689492.3690047(38-53)Online publication date: 17-Oct-2024
  • (2022)Low overhead and context sensitive profiling of GPU-accelerated applicationsProceedings of the 36th ACM International Conference on Supercomputing10.1145/3524059.3532388(1-13)Online publication date: 28-Jun-2022
  • (2021)StackBERTProceedings of the 14th ACM Workshop on Artificial Intelligence and Security10.1145/3474369.3486865(85-95)Online publication date: 15-Nov-2021
  • (2021)Retrofitting effect handlers onto OCamlProceedings of the 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation10.1145/3453483.3454039(206-221)Online publication date: 19-Jun-2021
  • (2021)Incremental CFG patching for binary rewritingProceedings of the 26th ACM International Conference on Architectural Support for Programming Languages and Operating Systems10.1145/3445814.3446765(1020-1033)Online publication date: 19-Apr-2021

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Get Access

Login options

Full Access

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media