Accelerating Dynamic Detection of Memory Errors for C Programs via Static Analysis

350 words maximum: (PLEASE TYPE) Abstract Memory errors in C programs are the root causes of many defects and vulnerabilities in software engineering. Among the available error detection techniques, dynamic analysis is widely used in industries due to its high precision. Unfortunately, existing approaches su↵er from considerable runtime overheads, owing to unguided and overly conservative instrumentation. With the massive growth of software nowadays, such ine ciency prevents testing with comprehensive program inputs, leaving some input-specific memory errors undetected. This thesis presents novel techniques to address the e ciency problem by eliminating some unnecessary instrumentation guided by static analysis. Targeting two major types of memory errors, the research has developed two tools, Usher and WPBound, both implemented in the LLVM compiler infrastructure, to accelerate the dynamic detection. To facilitate e cient detection of undefined value uses, Usher infers the definedness of values using a value-flow graph that captures def-use information for both top-level and address-taken variables interprocedurally, and removes unnecessary instrumentation by solving a graph reachability problem. Usher works well with any pointer analysis (done a priori) and enables advanced instrumentation-reducing optimizations. For e cient detection of spatial errors (e.g., bu↵er overflows), WPBound enhances the performance by reducing unnecessary bounds checks. The basic idea is to guard a bounds check at a memory access inside a loop, where the guard is computed outside the loop based on the notion of weakest precondition. The falsehood of the guard implies the absence of out-of-bounds errors at the dereference, thereby avoiding the corresponding bounds check inside the loop. For each tool, this thesis presents the methodology and evaluates the implementation with a set of C benchmarks. Their e↵ectiveness is demonstrated with significant speedups over the state-of-the-art tools. i Declaration relating to disposition of project thesis/dissertation I hereby grant to the University of New South Wales or its agents the right to archive and to make available my thesis or dissertation in whole or in part in the University libraries in all forms of media, now or here after known, subject to the provisions of the Copyright Act 1968. I retain all property rights, such as patent rights. I also retain the right to use in future works (such as articles or books) all or part of this thesis or dissertation. I also authorise University Microfilms to use the 350 word abstract of my thesis in Dissertation Abstracts International (this is applicable to doctoral theses only). Signature . Witness . Date The University recognises that there may be exceptional circumstances requiring restrictions on copying or conditions on use. Requests for restriction for a period of up to 2 years must be made in writing. Requests for a longer period of restriction may be considered in exceptional circumstances and require the approval of the Dean of Graduate Research. FOR OFFICE USE ONLY Date of completion of requirements for Award: THIS SHEET IS TO BE GLUED TO THE INSIDE FRONT COVER OF THE THESIS 10/Feb/2015 ORIGINALITY STATEMENT ‘I hereby declare that this submission is my own work and to the best of my knowledge it contains no materials previously published or written by another person, or substantial proportions of material which have been accepted for the award of any other degree or diploma at UNSW or any other educational institution, except where due acknowledgement is made in the thesis. Any contribution made to the research by others, with whom I have worked at UNSW or elsewhere, is explicitly acknowledged in the thesis. I also declare that the intellectual content of this thesis is the product of my own work, except to the extent that assistance from others in the project's design and conception or in style, presentation and linguistic expression is acknowledged. ’ Signed . Date . 10/Feb/2015 COPYRIGHT STATEMENT ‘I hereby grant the University of New South Wales or its agents the right to archive and to make available my thesis or dissertation in whole or part in the University libraries in all forms of media, now or here after known, subject to the provisions of the Copyright Act 1968. I retain all proprietary rights, such as patent rights. I also retain the right to use in future works (such as articles or books) all or part of this thesis or dissertation. I also authorise University Microfilms to use the 350 word abstract of my thesis in Dissertation Abstract International (this is applicable to doctoral theses only). I have either used no substantial portions of copyright material in my thesis or I have obtained permission to use copyright material; where permission has not been granted I have applied/will apply for a partial restriction of the digital copy of my thesis or dissertation. ' Signed . Date . AUTHENTICITY STATEMENT ‘I certify that the Library deposit digital copy is a direct equivalent of the final officially approved version of my thesis. No emendation of content has occurred and if there are any minor variations in formatting, they are the result of the conversion to digital format. ’ Signed . Date . 10/Feb/2015