Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
research-article
Open access

Cut to the Chase: An Error-Oriented Approach to Detect Error-Handling Bugs

Published: 12 July 2024 Publication History

Abstract

Error-handling bugs are prevalent in software systems and can result in severe consequences. Existing works on error-handling bug detection can be categorized into template-based and learning-based approaches. The former requires much human effort and is difficult to accommodate the software evolution. The latter usually focuses on errors of API and assumes that error handling should be right after the handled error. Such an assumption, however, may affect both learning and detecting phases. The existing learning-based approaches can be regarded as API-oriented, which starts from an API and learns if the API requires error handling. In this paper, we propose EH-Digger, an ERROR-oriented approach, which starts from an error handling. Our approach can learn why the error occurs and when the error has to be handled. We conduct a comprehensive study on 2,322 error-handling code snippets from 22 widely used software systems across 8 software domains to reveal the limitation of existing approaches and guide the design of EH-Digger. We evaluated EH-Digger on the Linux Kernel and 11 open-source applications. It detected 53 new bugs confirmed by the developers and 71 historical bugs fixed in the latest versions. We also compared EH-Digger with three state-of-the-art approaches, 30.1% of bugs detected by EH-Digger cannot be detected by the existing approaches.

References

[1]
Mithun Acharya and Tao Xie. 2009. Mining API error-handling specifications from source code. In International Conference on Fundamental Approaches to Software Engineering. 370–384.
[2]
Eiji Adachi Barbosa and Alessandro Garcia. 2018. Global-aware recommendations for repairing violations in exception handling. In Proceedings of the 40th International Conference on Software Engineering. 858–858.
[3]
Pan Bian, Bin Liang, Yan Zhang, Chaoqun Yang, Wenchang Shi, and Yan Cai. 2018. Detecting bugs by discovering expectations and their violations. IEEE Transactions on Software Engineering, 45, 10 (2018), 984–1001.
[4]
Islem Bouzenia. 2022. Detecting Inconsistencies in If-Condition-Raise Statements. In 37th IEEE/ACM International Conference on Automated Software Engineering. 1–3.
[5]
M. Brunsfeld. 2023. Tree-sitter. https://tree-sitter.github.io/tree-sitter/ Accessed 1. October 2021
[6]
Haicheng Chen. 2021. Combating Fault Tolerance Bugs in Cloud Systems. The Ohio State University.
[7]
Haogang Chen, Yandong Mao, Xi Wang, Dong Zhou, Nickolai Zeldovich, and M Frans Kaashoek. 2011. Linux kernel vulnerabilities: State-of-the-art defenses and open problems. In Proceedings of the Second Asia-Pacific Workshop on Systems. 1–5.
[8]
Thomas H Cormen, Charles E Leiserson, Ronald L Rivest, and Clifford Stein. 2022. Introduction to algorithms. MIT press.
[9]
Daniel DeFreez, Haaken Martinson Baldwin, Cindy Rubio-González, and Aditya V Thakur. 2019. Effective error-specification inference via domain-knowledge expansion. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 466–476.
[10]
Daniel DeFreez, Antara Bhowmick, Ignacio Laguna, and Cindy Rubio-González. 2020. Detecting and reproducing error-code propagation bugs in MPI implementations. In Proceedings of the 25th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. 187–201.
[11]
Zhengxiao Du, Yujie Qian, Xiao Liu, Ming Ding, Jiezhong Qiu, Zhilin Yang, and Jie Tang. 2022. GLM: General Language Model Pretraining with Autoregressive Blank Infilling. 320–335.
[12]
Tianxiao Gu, Chengnian Sun, Xiaoxing Ma, Jian Lü, and Zhendong Su. 2016. Automatic runtime recovery via error handler synthesis. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering. 684–695.
[13]
Haryadi S Gunawi, Cindy Rubio-González, Andrea C Arpaci-Dusseau, Remzi H Arpaci-Dusseau, and Ben Liblit. 2008. EIO: Error Handling is Occasionally Correct. In FAST. 8, 1–16.
[14]
Foyzul Hassan, Chetan Bansal, Nachiappan Nagappan, Thomas Zimmermann, and Ahmed Hassan Awadallah. 2020. An empirical study of software exceptions in the field using search logs. In Proceedings of the 14th ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM). 1–12.
[15]
Benjamin Jakobus, Eiji Adachi Barbosa, Alessandro Garcia, and Carlos José Pereira De Lucena. 2015. Contrasting exception handling code across languages: An experience report involving 50 open source projects. In 2015 IEEE 26th International Symposium on Software Reliability Engineering (ISSRE). 183–193.
[16]
Suman Jana, Yuan Jochen Kang, Samuel Roth, and Baishakhi Ray. 2016. Automatically Detecting Error Handling Bugs Using Error Specifications. In USENIX Security Symposium. 345–362.
[17]
Zhouyang Jia, Shanshan Li, Xiaodong Liu, Xiangke Liao, and Yunhuai Liu. 2018. SMARTLOG: Place error log statement by deep understanding of log intention. In 2018 IEEE 25th International Conference on Software Analysis, Evolution and Reengineering (SANER). 61–71.
[18]
Zhouyang Jia, Shanshan Li, Tingting Yu, Xiangke Liao, and Ji Wang. 2019. Automatically detecting missing cleanup for ungraceful exits. In Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. 751–762.
[19]
Zhouyang Jia, Shanshan Li, Tingting Yu, Xiangke Liao, Ji Wang, Xiaodong Liu, and Yunhuai Liu. 2019. Detecting error-handling bugs without error specification input. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE). 213–225.
[20]
Yuan Kang, Baishakhi Ray, and Suman Jana. 2016. Apex: Automated inference of error specifications for c apis. In Proceedings of the 31st IEEE/ACM International Conference on Automated Software Engineering. 472–482.
[21]
Sun Hyoung Kim, Cong Sun, Dongrui Zeng, and Gang Tan. 2021. Refining Indirect Call Targets at the Binary Level. In NDSS.
[22]
Jean-Claude Laprie. 1995. Dependable computing: Concepts, limits, challenges. In Special issue of the 25th international symposium on fault-tolerant computing. 42–54.
[23]
Julia Lawall, Ben Laurie, René Rydhof Hansen, Nicolas Palix, and Gilles Muller. 2010. Finding error handling bugs in openssl using coccinelle. In 2010 European Dependable Computing Conference. 191–196.
[24]
Yan Lei, Chengnian Sun, Xiaoguang Mao, and Zhendong Su. 2018. How test suites impact fault localisation starting from the size. IET software, 12, 3 (2018), 190–205.
[25]
Chi Li, Min Zhou, Zuxing Gu, Ming Gu, and Hongyu Zhang. 2019. Ares: Inferring error specifications through static analysis. In 2019 34th IEEE/ACM International Conference on Automated Software Engineering (ASE). 1174–1177.
[26]
Chi Li, Min Zhou, Xinrong Han, and Ming Gu. 2021. Sensing Error Handling Bugs in SSL Library Usages. In 2021 IEEE 20th International Conference on Trust, Security and Privacy in Computing and Communications (TrustCom). 686–692.
[27]
Huqiu Liu, Yuping Wang, Lingbo Jiang, and Shimin Hu. 2014. PF-Miner: A new paired functions mining method for Android kernel in error paths. In 2014 IEEE 38th Annual Computer Software and Applications Conference. 33–42.
[28]
Kangjie Lu and Hong Hu. 2019. Where does it go? refining indirect-call targets with multi-layer type analysis. In Proceedings of the 2019 ACM SIGSAC Conference on Computer and Communications Security. 1867–1881.
[29]
Kangjie Lu Lu, Aditya Pakki, and Qiushi Wu. 2019. Detecting missing-check bugs via semantic-and context-aware criticalness and constraints inferences. In Proceedings of the 28th USENIX Conference on Security Symposium.
[30]
Xiaoguang Mao, Yan Lei, Ziying Dai, Yuhua Qi, and Chengsong Wang. 2014. Slice-based statistical fault localization. Journal of Systems and Software, 89 (2014), 51–62.
[31]
Paul D Marinescu and George Candea. 2009. LFI: A practical and general library-level fault injector. In 2009 IEEE/IFIP International Conference on Dependable Systems & Networks. 379–388.
[32]
Tam Nguyen, Phong Vu, and Tung Nguyen. 2019. Recommending exception handling code. In 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME). 390–393.
[33]
Juliana Oliveira, Deise Borges, Thaisa Silva, Nelio Cacho, and Fernando Castor. 2018. Do android developers neglect error handling? a maintenance-Centric study on the relationship between android abstractions and uncaught exceptions. Journal of Systems and Software, 136 (2018), 1–18.
[34]
Aditya Pakki and Kangjie Lu. 2020. Exaggerated error handling hurts! an in-depth study and context-aware detection. In Proceedings of the 2020 ACM SIGSAC Conference on Computer and Communications Security. 1203–1218.
[35]
Jian Pei, Jiawei Han, Behzad Mortazavi-Asl, Jianyong Wang, Helen Pinto, Qiming Chen, Umeshwar Dayal, and Mei-Chun Hsu. 2004. Mining sequential patterns by pattern-growth: The prefixspan approach. IEEE Transactions on knowledge and data engineering, 16, 11 (2004), 1424–1440.
[36]
Genymobile R. Vimont. 2023. Scrcpy utility. https://github.com/Genymobile/scrcpy Accessed 1. March 2023
[37]
Martin P Robillard and Gail C Murphy. 2000. Designing robust Java programs with exceptions. In Proceedings of the 8th ACM SIGSOFT international symposium on Foundations of software engineering: twenty-first century applications. 2–10.
[38]
Cindy Rubio-González, Haryadi S Gunawi, Ben Liblit, Remzi H Arpaci-Dusseau, and Andrea C Arpaci-Dusseau. 2009. Error propagation analysis for file systems. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation. 270–280.
[39]
Qintao Shen, Hongyu Sun, Guozhu Meng, Kai Chen, and Yuqing Zhang. 2023. Detecting API Missing-Check Bugs Through Complete Cross Checking of Erroneous Returns. In International Conference on Information Security and Cryptology. 391–407.
[40]
Sooel Son, Kathryn S McKinley, and Vitaly Shmatikov. 2011. Rolecast: finding missing security checks when you do not know what checks are. In Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications. 1069–1084.
[41]
Wensheng Tang. 2019. Identifying error code misuses in complex system. In Proceedings of the 28th ACM SIGSOFT International Symposium on Software Testing and Analysis. 428–432.
[42]
Yuchi Tian and Baishakhi Ray. 2017. Automatically diagnosing and repairing error handling bugs in c. In Proceedings of the 2017 11th joint meeting on foundations of software engineering. 752–762.
[43]
Westley Weimer. 2004. Finding and preventing run-time error handling mistakes. In Proceedings of the 19th annual ACM SIGPLAN Conference on Object-oriented programming, systems, languages, and applications. 419–431.
[44]
Westley Weimer and George C Necula. 2008. Exceptional situations and program reliability. ACM Transactions on Programming Languages and Systems (TOPLAS), 30, 2 (2008), 1–51.
[45]
Baijun Wu, John Peter Campora III, Yi He, Alexander Schlecht, and Sheng Chen. 2019. Generating precise error specifications for c: A zero shot learning approach. Proceedings of the ACM on Programming Languages, 3, OOPSLA (2019), 1–30.
[46]
Qiushi Wu, Aditya Pakki, Navid Emamdoost, Stephen McCamant, and Kangjie Lu. 2021. Understanding and detecting disordered error handling with precise function pairing. In the 30th USENIX Security Symposium (Security’21).
[47]
Xuezheng Xu, Yulei Sui, Hua Yan, and Jingling Xue. 2019. VFix: value-flow-guided precise program repair for null pointer dereferences. In 2019 IEEE/ACM 41st International Conference on Software Engineering (ICSE). 512–523.
[48]
Fabian Yamaguchi, Christian Wressnegger, Hugo Gascon, and Konrad Rieck. 2013. Chucky: Exposing missing checks in source code for vulnerability discovery. In Proceedings of the 2013 ACM SIGSAC conference on Computer & communications security. 499–510.
[49]
Dongyang Zhan, Xiangzhan Yu, Hongli Zhang, and Lin Ye. 2022. ErrHunter: Detecting Error-Handling Bugs in the Linux Kernel Through Systematic Static Analysis. IEEE Transactions on Software Engineering, 49, 2 (2022), 684–698.
[50]
Hao Zhong. 2022. Which Exception Shall We Throw? In Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering. 1–12.
[51]
Hao Zhong, Lu Zhang, Tao Xie, and Hong Mei. 2009. Inferring resource specifications from natural language API documentation. In 2009 IEEE/ACM International Conference on Automated Software Engineering. 307–318.

Index Terms

  1. Cut to the Chase: An Error-Oriented Approach to Detect Error-Handling Bugs

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image Proceedings of the ACM on Software Engineering
    Proceedings of the ACM on Software Engineering  Volume 1, Issue FSE
    July 2024
    2770 pages
    EISSN:2994-970X
    DOI:10.1145/3554322
    Issue’s Table of Contents
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the owner/author(s).

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 12 July 2024
    Published in PACMSE Volume 1, Issue FSE

    Author Tags

    1. Bug Detection
    2. Error Handling
    3. Error Oriented

    Qualifiers

    • Research-article

    Funding Sources

    • NSFC
    • the Science and Technology Innovation Program of Hunan Province

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • 0
      Total Citations
    • 180
      Total Downloads
    • Downloads (Last 12 months)180
    • Downloads (Last 6 weeks)68
    Reflects downloads up to 13 Nov 2024

    Other Metrics

    Citations

    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