\documentclass[12pt,a4paper]{article} \usepackage[cm]{fullpage} \usepackage{amsthm} \usepackage{amsmath} \usepackage{amsfonts} \usepackage{amssymb} \usepackage{xspace} \usepackage[english]{babel} \usepackage{fancyhdr} \usepackage{titling} \renewcommand{\thesection}{Exercise \projnumber.\arabic{section}:} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This part needs customization from you % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % please enter your group number your names and matriculation numbers here %TODO \newcommand{\groupnumber}{5} \newcommand{\name}{Tobias Eidelpes} \newcommand{\matriculation}{01527193} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % End of customization % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcommand{\projnumber}{3} \newcommand{\Title}{minnieThor} \setlength{\headheight}{15.2pt} \setlength{\headsep}{20pt} \setlength{\textheight}{680pt} \pagestyle{fancy} \fancyhf{} \fancyhead[L]{Formal Methods for Security and Privacy \projnumber\ - minnieThor} \fancyhead[C]{} \fancyhead[R]{Group \groupnumber} \renewcommand{\headrulewidth}{0.4pt} \fancyfoot[C]{\thepage} \begin{document} \thispagestyle{empty} \noindent\framebox[\linewidth]{% \begin{minipage}{\linewidth}% \hspace*{5pt} \textbf{Formal Methods for Security and Privacy (SS2021)} \hfill Prof.~Matteo Maffei \hspace*{5pt}\\ \begin{center} {\bf\Large Project \projnumber~-- \Title} \end{center} \vspace*{5pt}\hspace*{5pt} \hfill TU Wien \hspace*{5pt} \end{minipage}% } \vspace{0.5cm} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \section*{Group \groupnumber} Our group consists of the following members: \begin{center} \textbf{\name} %please fill the information above \matriculation %please fill the information above \end{center} \section{Abstract Semantics} \emph{Nothing to fill in here, unless you feel that there is something about the implementation that we should consider when grading.} \section{Fixing reentrancy} \subsubsection*{Justification for the soundness of \texttt{alice.txt}:} By switching the order of line 5 and line 6 in \texttt{alice.txt}, the contract \texttt{bob.txt} has been fixed. This works because \texttt{sent} is set to 1 \emph{before} the call instruction is executed and therefore reentering the function is possible but will not execute another call instruction because \texttt{sent} has already been set to 1. The contract now follows the \emph{Check-Effects-Interactions Pattern}, which requires that checks and state changes have to occur before calls to other contracts. \section{Soundness of the \texttt{CALL} rules} \subsubsection*{Soundness classification of \texttt{CALL} rule sets:} \textbf{Call 1}: Unsound \\ \textbf{Call 2}: Sound \\ \textbf{Call 3}: Unsound \\ \textbf{Call 4}: Unsound \\ \textbf{Call 5}: Sound \subsubsection*{Intuition for the sound rule sets:} \paragraph{Call 2:} The first two rules are the same rules as presented in the lecture. The third rule models the case where the contract resumes execution after a call with the same storage as before the call. This rule applies when the contract was not called and produced a successful halting state before the contract resumes the execution after the call. The fourth rule, however, models the case where the contract resumes execution after it was left by another call from a contract that resulted in a halting state. \paragraph{Call 5:} As for Call 2, the first two rules are the same as presented in the lecture. The third rule is correct because in case of $sa[size - 4] = 1$, the local memory and the persistent storage are correctly over-approximated. The other case is where $sa[size - 4] = 0$. In this case the caller's memory may not be manipulated, as formalized by the small-step semantics. \end{document}