| 1 | % T I T L E P A G E
|
|---|
| 2 | % -------------------
|
|---|
| 3 | % Last updated August 16, 2022, by IST-Client Services
|
|---|
| 4 | % The title page is counted as page `i' but we need to suppress the
|
|---|
| 5 | % page number. Also, we don't want any headers or footers.
|
|---|
| 6 | \pagestyle{empty}
|
|---|
| 7 | \pagenumbering{roman}
|
|---|
| 8 |
|
|---|
| 9 | % The contents of the title page are specified in the "titlepage"
|
|---|
| 10 | % environment.
|
|---|
| 11 | \begin{titlepage}
|
|---|
| 12 | \begin{center}
|
|---|
| 13 | \vspace*{1.0cm}
|
|---|
| 14 |
|
|---|
| 15 | % TODO: punch up the title, thinking getting interest in the department-wide posting of my presentation
|
|---|
| 16 | % Modern collections for C
|
|---|
| 17 | {\Huge\bf \CFA Container Library}
|
|---|
| 18 |
|
|---|
| 19 | \vspace*{1.0cm}
|
|---|
| 20 |
|
|---|
| 21 | by \\
|
|---|
| 22 |
|
|---|
| 23 | \vspace*{1.0cm}
|
|---|
| 24 |
|
|---|
| 25 | {\Large Michael Leslie Brooks} \\
|
|---|
| 26 |
|
|---|
| 27 | \vspace*{3.0cm}
|
|---|
| 28 |
|
|---|
| 29 | A thesis \\
|
|---|
| 30 | presented to the University of Waterloo \\
|
|---|
| 31 | in fulfillment of the \\
|
|---|
| 32 | thesis requirement for the degree of \\
|
|---|
| 33 | Master of Mathematics \\
|
|---|
| 34 | in \\
|
|---|
| 35 | Computer Science \\
|
|---|
| 36 |
|
|---|
| 37 | \vspace*{2.0cm}
|
|---|
| 38 |
|
|---|
| 39 | Waterloo, Ontario, Canada, \the\year \\
|
|---|
| 40 |
|
|---|
| 41 | \vspace*{1.0cm}
|
|---|
| 42 |
|
|---|
| 43 | \copyright{} Michael Leslie Brooks \the\year \\
|
|---|
| 44 | \end{center}
|
|---|
| 45 | \end{titlepage}
|
|---|
| 46 |
|
|---|
| 47 | % The rest of the front pages should contain no headers and be numbered using Roman numerals starting with `ii'
|
|---|
| 48 | \pagestyle{plain}
|
|---|
| 49 | \setcounter{page}{2}
|
|---|
| 50 |
|
|---|
| 51 | \cleardoublepage % Ends the current page and causes all figures and tables that have so far appeared in the input to be printed.
|
|---|
| 52 | % In a two-sided printing style, it also makes the next page a right-hand (odd-numbered) page, producing a blank page if necessary.
|
|---|
| 53 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 54 |
|
|---|
| 55 | \begin{comment}
|
|---|
| 56 | % E X A M I N I N G C O M M I T T E E (Required for Ph.D. theses only)
|
|---|
| 57 | % Remove or comment out the lines below to remove this page
|
|---|
| 58 | \addcontentsline{toc}{chapter}{Examining Committee}
|
|---|
| 59 | \begin{center}\textbf{Examining Committee Membership}\end{center}
|
|---|
| 60 | \noindent
|
|---|
| 61 | The following served on the Examining Committee for this thesis. The decision of the Examining Committee is by majority vote.
|
|---|
| 62 | \bigskip
|
|---|
| 63 |
|
|---|
| 64 | \noindent
|
|---|
| 65 | \begin{tabbing}
|
|---|
| 66 | Internal-External Member: \= \kill % using longest text to define tab length
|
|---|
| 67 | External Examiner: \> Bruce Bruce \\
|
|---|
| 68 | \> Professor, Dept. of Philosophy of Zoology, University of Wallamaloo \\
|
|---|
| 69 | \end{tabbing}
|
|---|
| 70 | \bigskip
|
|---|
| 71 |
|
|---|
| 72 | \noindent
|
|---|
| 73 | \begin{tabbing}
|
|---|
| 74 | Internal-External Member: \= \kill % using longest text to define tab length
|
|---|
| 75 | Supervisor(s): \> Ann Elk \\
|
|---|
| 76 | \> Professor, Dept. of Zoology, University of Waterloo \\
|
|---|
| 77 | \> Andrea Anaconda \\
|
|---|
| 78 | \> Professor Emeritus, Dept. of Zoology, University of Waterloo \\
|
|---|
| 79 | \end{tabbing}
|
|---|
| 80 | \bigskip
|
|---|
| 81 |
|
|---|
| 82 | \noindent
|
|---|
| 83 | \begin{tabbing}
|
|---|
| 84 | Internal-External Member: \= \kill % using longest text to define tab length
|
|---|
| 85 | Internal Member: \> Pamela Python \\
|
|---|
| 86 | \> Professor, Dept. of Zoology, University of Waterloo \\
|
|---|
| 87 | \end{tabbing}
|
|---|
| 88 | \bigskip
|
|---|
| 89 |
|
|---|
| 90 | \noindent
|
|---|
| 91 | \begin{tabbing}
|
|---|
| 92 | Internal-External Member: \= \kill % using longest text to define tab length
|
|---|
| 93 | Internal-External Member: \> Meta Meta \\
|
|---|
| 94 | \> Professor, Dept. of Philosophy, University of Waterloo \\
|
|---|
| 95 | \end{tabbing}
|
|---|
| 96 | \bigskip
|
|---|
| 97 |
|
|---|
| 98 | \noindent
|
|---|
| 99 | \begin{tabbing}
|
|---|
| 100 | Internal-External Member: \= \kill % using longest text to define tab length
|
|---|
| 101 | Other Member(s): \> Leeping Fang \\
|
|---|
| 102 | \> Professor, Dept. of Fine Art, University of Waterloo \\
|
|---|
| 103 | \end{tabbing}
|
|---|
| 104 |
|
|---|
| 105 | \cleardoublepage
|
|---|
| 106 | \end{comment}
|
|---|
| 107 |
|
|---|
| 108 | % D E C L A R A T I O N P A G E
|
|---|
| 109 | % -------------------------------
|
|---|
| 110 | % The following is a sample Declaration Page as provided by the GSO
|
|---|
| 111 | % December 13th, 2006. It is designed for an electronic thesis.
|
|---|
| 112 | \addcontentsline{toc}{chapter}{Author's Declaration}
|
|---|
| 113 | \begin{center}\textbf{Author's Declaration}\end{center}
|
|---|
| 114 |
|
|---|
| 115 | \noindent
|
|---|
| 116 | I hereby declare that I am the sole author of this thesis. This is a true copy of the thesis, including any required final revisions, as accepted by my examiners.
|
|---|
| 117 |
|
|---|
| 118 | \bigskip
|
|---|
| 119 |
|
|---|
| 120 | \noindent
|
|---|
| 121 | I understand that my thesis may be made electronically available to the public.
|
|---|
| 122 |
|
|---|
| 123 | \cleardoublepage
|
|---|
| 124 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 125 |
|
|---|
| 126 | % A B S T R A C T
|
|---|
| 127 | % ---------------
|
|---|
| 128 | \addcontentsline{toc}{chapter}{Abstract}
|
|---|
| 129 | \begin{center}\textbf{Abstract}\end{center}
|
|---|
| 130 |
|
|---|
| 131 | \CFA strives to fix mistakes in C, chief among them, safety.
|
|---|
| 132 | This thesis presents a significant step forward in \CFA's goal to remove unsafe pointer operations.
|
|---|
| 133 | The thesis presents improvements to the \CFA language design, both syntax and semantics, to support advanced container features.
|
|---|
| 134 | These features are implemented across the \CFA compiler, libraries, and runtime system.
|
|---|
| 135 | The results maintain another \CFA goal of remaining 99\% backwards compatible with C.
|
|---|
| 136 | This thesis leverages preexisting work within the compiler's type and runtime systems generated by prior students working on the \CFA project.
|
|---|
| 137 |
|
|---|
| 138 | All modern programming languages provide three high-level containers (collections): array, linked-list, and string.
|
|---|
| 139 | Often array is part of the programming language, while linked-lists are built from (recursive) pointer types, and strings from a combination of array and linked-list.
|
|---|
| 140 | For all three types, languages and/or their libraries supply varying degrees of high-level mechanisms for manipulating these objects at the bulk and component level, such as copying, slicing, extracting, and iterating among elements.
|
|---|
| 141 | Unfortunately, these three aspects of C cause 60\%--70\% of the reported software vulnerabilities involving memory errors, and 70\%--80\% of hacker attack-vectors target these types.
|
|---|
| 142 | Therefore, hardening these three C types goes a long way to make the majority of C programs safer.
|
|---|
| 143 |
|
|---|
| 144 | Specifically, an array utility is provided that tracks length internally, relieving the user of managing explicit length parameters and stopping buffer-overrun errors.
|
|---|
| 145 | This feature requires augmenting the \CFA type system, making array length available at compile and runtime.
|
|---|
| 146 | A linked-list utility is provided, which obviates many explicit recursive pointers by catering directly to system-programming uses (intrusive lists) for which a library solution is often dismissed.
|
|---|
| 147 | Finally, a string utility is provided with implicit memory management of text in a specialized heap, relieving error-prone buffer management, including overrun, and providing a copy-on-write speed boost.
|
|---|
| 148 | For all three utilities, performance is argued to be on-par with, and occasionally surpassing relevant comparators.
|
|---|
| 149 | With the array, this case is made by showing complete erasure down to a naked C array, modulo runtime bound checks, which are removable more often than with Java-style length management.
|
|---|
| 150 | With the linked list and string, empirical measures are compared with relevant libraries.
|
|---|
| 151 | These utilities offer a system programmer workable alternatives to hand-rolling several common causes of system vulnerabilities, thereby improving \CFA's position as a safety-forward system-programming alternative.
|
|---|
| 152 |
|
|---|
| 153 | \cleardoublepage
|
|---|
| 154 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 155 |
|
|---|
| 156 | % A C K N O W L E D G E M E N T S
|
|---|
| 157 | % -------------------------------
|
|---|
| 158 | \addcontentsline{toc}{chapter}{Acknowledgements}
|
|---|
| 159 | \begin{center}\textbf{Acknowledgements}\end{center}
|
|---|
| 160 |
|
|---|
| 161 | I would like to thank all the little people who made this thesis possible.
|
|---|
| 162 |
|
|---|
| 163 | Finally, a special thank you to Huawei Canada for funding this work.
|
|---|
| 164 | \cleardoublepage
|
|---|
| 165 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 166 |
|
|---|
| 167 | \begin{comment}
|
|---|
| 168 | % D E D I C A T I O N
|
|---|
| 169 | % -------------------
|
|---|
| 170 | \addcontentsline{toc}{chapter}{Dedication}
|
|---|
| 171 | \begin{center}\textbf{Dedication}\end{center}
|
|---|
| 172 |
|
|---|
| 173 | This is dedicated to the one I love.
|
|---|
| 174 | \cleardoublepage
|
|---|
| 175 | \end{comment}
|
|---|
| 176 |
|
|---|
| 177 | % T A B L E O F C O N T E N T S
|
|---|
| 178 | % ---------------------------------
|
|---|
| 179 | \renewcommand\contentsname{Table of Contents}
|
|---|
| 180 | \tableofcontents
|
|---|
| 181 | \cleardoublepage
|
|---|
| 182 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 183 |
|
|---|
| 184 | % L I S T O F F I G U R E S
|
|---|
| 185 | % -----------------------------
|
|---|
| 186 | \addcontentsline{toc}{chapter}{List of Figures}
|
|---|
| 187 | \listoffigures
|
|---|
| 188 | \cleardoublepage
|
|---|
| 189 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 190 |
|
|---|
| 191 | % L I S T O F T A B L E S
|
|---|
| 192 | % ---------------------------
|
|---|
| 193 | \addcontentsline{toc}{chapter}{List of Tables}
|
|---|
| 194 | \listoftables
|
|---|
| 195 | \cleardoublepage
|
|---|
| 196 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 197 |
|
|---|
| 198 | \begin{comment}
|
|---|
| 199 | % L I S T O F A B B R E V I A T I O N S
|
|---|
| 200 | % ---------------------------
|
|---|
| 201 | \renewcommand*{\abbreviationsname}{List of Abbreviations}
|
|---|
| 202 | \printglossary[type=abbreviations]
|
|---|
| 203 | \cleardoublepage
|
|---|
| 204 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 205 |
|
|---|
| 206 | % L I S T O F S Y M B O L S
|
|---|
| 207 | % ---------------------------
|
|---|
| 208 | \printglossary[type=symbols]
|
|---|
| 209 | \cleardoublepage
|
|---|
| 210 | \phantomsection % allows hyperref to link to the correct page
|
|---|
| 211 | \end{comment}
|
|---|
| 212 |
|
|---|
| 213 | % Change page numbering back to Arabic numerals
|
|---|
| 214 | \pagenumbering{arabic}
|
|---|