skip to main content
10.1145/1967677.1967684acmconferencesArticle/Chapter ViewAbstractPublication PagescpsweekConference Proceedingsconference-collections
research-article

An approach to improving the structure of error-handling code in the linux kernel

Published: 11 April 2011 Publication History

Abstract

The C language does not provide any abstractions for exception handling or other forms of error handling, leaving programmers to devise their own conventions for detecting and handling errors. The Linux coding style guidelines suggest placing error handling code at the end of each function, where it can be reached by gotos whenever an error is detected. This coding style has the advantage of putting all of the error-handling code in one place, which eases understanding and maintenance, and reduces code duplication. Nevertheless, this coding style is not always applied. In this paper, we propose an automatic program transformation that transforms error-handling code into this style. We have applied our transformation to the Linux 2.6.34 kernel source code, on which it reorganizes the error handling code of over 1800 functions, in about 25 minutes.

References

[1]
M. Bruntink. Reengineering idiomatic exception handling in legacy C code. In 12th European Conference on Software Maintenance and Reengineering (CSMR), pages 133--142, Athens, Greece, Apr. 2008.
[2]
Bruntink:ICSE06M. Bruntink, A. van Deursen, and T. Tourwé. Discovering faults in idiom-based exception handling. In 28th International Conference on Software Engineering (ICSE), pages 242--251, Shanghai, China, May 2006.
[3]
P. A. Buhr and W. Y. R. Mok. Advanced exception handling mechanisms. IEEE Trans. Software Eng., 26 (9): 820--836, 2000.
[4]
CDT. CDT/User/FAQ -- Eclipsepedia, 2010. \newline\fnamehttp://wiki.eclipse.org/CDT/User/FAQ.
[5]
Ferreira, and Garcia}Filho:06F. C. Filho, C. M. F. Rubira, R. de A. Maranhão Ferreira, and A. Garcia. Aspectizing exception handling: A quantitative study. In Advanced Topics in Exception Handling Techniques, volume 4119 of Lecture Notes in Computer Science, pages 255--274. Springer, 2006.
[6]
M. Fowler. Refactoring: Improving the Design of Existing Code. Addison Wesley, 1999.
[7]
A. F. Garcia, C. M. F. Rubira, A. B. Romanovsky, and J. Xu. A comparative study of exception handling mechanisms for building dependable object-oriented software. Journal of Systems and Software, 59 (2): 197--222, 2001.
[8]
J. B. Goodenough. Exception handling: Issues and a proposed notation. Commun. ACM, 18 (12): 683--696, 1975.
[9]
B. McCloskey and E. Brewer. ASTEC: a new approach to refactoring C. In ESEC/FSE-13, pages 21--30, Lisbon, Portugal, 2005.
[10]
M. Mortensen and S. Ghosh. Refactoring idiomatic exception handling in C
[11]
: Throwing and catching exceptions with aspects. In Industry Track of the International Conference on Aspect-Oriented Software Development (AOSD), Vancouver, Canada, Mar. 2007.
[12]
Y. Padioleau. Parsing C/C
[13]
code without pre-processing. In Compiler Construction (CC'09), pages 109--125, York, UK, Mar. 2009.
[14]
Y. Padioleau, J. Lawall, R. R. Hansen, and G. Muller. Documenting and automating collateral evolutions in Linux device drivers. In EuroSys 2008, pages 247--260, Glasgow, Scotland, Mar. 2008.
[15]
N. Palix, G. Thomas, S. Saha, C. Calvès, J. Lawall, and G. Muller. Faults in Linux: Ten years later. In Sixteenth International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), Newport Beach, CA, USA, Mar. 2011.
[16]
W. Weimer and G. C. Necula. Exceptional situations and program reliability. ACM Transactions on Programming Languages and Systems, 30 (2), 2008.
[17]
D. A. Wheeler. SLOCCount. \newline \fnamehttp://www.dwheeler.com/sloccount/.

Cited By

View all
  • (2023)ErrHunter: Detecting Error-Handling Bugs in the Linux Kernel Through Systematic Static AnalysisIEEE Transactions on Software Engineering10.1109/TSE.2022.316015549:2(684-698)Online publication date: 1-Feb-2023
  • (2019)Fuzzing Error Handling Code in Device Drivers Based on Software Fault Injection2019 IEEE 30th International Symposium on Software Reliability Engineering (ISSRE)10.1109/ISSRE.2019.00022(128-138)Online publication date: Oct-2019
  • (2016)CogentACM SIGARCH Computer Architecture News10.1145/2980024.287240444:2(175-188)Online publication date: 25-Mar-2016
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
LCTES '11: Proceedings of the 2011 SIGPLAN/SIGBED conference on Languages, compilers and tools for embedded systems
April 2011
182 pages
ISBN:9781450305556
DOI:10.1145/1967677
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 46, Issue 5
    LCTES '10
    May 2011
    170 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2016603
    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 components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 11 April 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. error handling
  2. exception handling
  3. linux

Qualifiers

  • Research-article

Conference

LCTES '11

Acceptance Rates

Overall Acceptance Rate 116 of 438 submissions, 26%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)1
Reflects downloads up to 15 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2023)ErrHunter: Detecting Error-Handling Bugs in the Linux Kernel Through Systematic Static AnalysisIEEE Transactions on Software Engineering10.1109/TSE.2022.316015549:2(684-698)Online publication date: 1-Feb-2023
  • (2019)Fuzzing Error Handling Code in Device Drivers Based on Software Fault Injection2019 IEEE 30th International Symposium on Software Reliability Engineering (ISSRE)10.1109/ISSRE.2019.00022(128-138)Online publication date: Oct-2019
  • (2016)CogentACM SIGARCH Computer Architecture News10.1145/2980024.287240444:2(175-188)Online publication date: 25-Mar-2016
  • (2016)CoGENTACM SIGOPS Operating Systems Review10.1145/2954680.287240450:2(175-188)Online publication date: 25-Mar-2016
  • (2016)CogentACM SIGPLAN Notices10.1145/2954679.287240451:4(175-188)Online publication date: 25-Mar-2016
  • (2016)CogentProceedings of the Twenty-First International Conference on Architectural Support for Programming Languages and Operating Systems10.1145/2872362.2872404(175-188)Online publication date: 25-Mar-2016
  • (2016)Mining and checking paired functions in device drivers using characteristic fault injectionInformation and Software Technology10.1016/j.infsof.2016.01.01873:C(122-133)Online publication date: 1-May-2016
  • (2015)An empirical study of goto in C code from GitHub repositoriesProceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering10.1145/2786805.2786834(404-414)Online publication date: 30-Aug-2015
  • (2015)Automated resource release in device driversProceedings of the 2015 IEEE 26th International Symposium on Software Reliability Engineering (ISSRE)10.1109/ISSRE.2015.7381811(172-182)Online publication date: 2-Nov-2015
  • (2015)Pairminer: mining for paired functions in Kernel extensions2015 IEEE International Symposium on Performance Analysis of Systems and Software (ISPASS)10.1109/ISPASS.2015.7095788(93-101)Online publication date: Mar-2015
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media