2018-10-26 15:42:37 +02:00
|
|
|
|
% vim: spell spelllang=en
|
|
|
|
|
|
2019-10-17 16:29:18 +02:00
|
|
|
|
\documentclass[12pt,xcolor={usenames,dvipsnames}]{beamer}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\usetheme{Warsaw}
|
|
|
|
|
\usepackage[utf8]{inputenc}
|
|
|
|
|
\usepackage[english]{babel}
|
|
|
|
|
\usepackage[T1]{fontenc}
|
|
|
|
|
\usepackage{amsmath}
|
|
|
|
|
\usepackage{amsfonts}
|
|
|
|
|
\usepackage{amssymb}
|
|
|
|
|
\usepackage{booktabs}
|
|
|
|
|
\usepackage{makecell}
|
|
|
|
|
\usepackage{ifthen}
|
|
|
|
|
\usepackage{colortbl}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\usepackage{tabularx}
|
2018-11-06 12:28:17 +01:00
|
|
|
|
\usepackage{pifont}
|
2019-10-11 11:45:35 +02:00
|
|
|
|
\usepackage{multirow}
|
2019-10-14 16:29:41 +02:00
|
|
|
|
\usepackage[many]{tcolorbox}
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\usepackage[absolute,overlay]{textpos}
|
2019-10-18 11:34:17 +02:00
|
|
|
|
\usetikzlibrary{arrows.meta,shapes}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
\usepackage{texlib/my_listings}
|
|
|
|
|
\usepackage{texlib/specific}
|
|
|
|
|
\usepackage{texlib/common}
|
|
|
|
|
\usepackage{texlib/todo}
|
|
|
|
|
|
|
|
|
|
\usepackage{inconsolata}
|
|
|
|
|
\lstset{basicstyle=\footnotesize\ttfamily}
|
|
|
|
|
|
|
|
|
|
\renewcommand\theadalign{c}
|
|
|
|
|
\renewcommand\theadfont{\scriptsize\bfseries}
|
|
|
|
|
|
|
|
|
|
\setbeamertemplate{navigation symbols}{}
|
|
|
|
|
\setbeamertemplate{headline}{}
|
|
|
|
|
|
2018-11-06 12:28:17 +01:00
|
|
|
|
\newcommand{\cmark}{\color{OliveGreen}\ding{52}}
|
|
|
|
|
\newcommand{\xmark}{\color{BrickRed}\ding{56}}
|
|
|
|
|
|
2019-10-17 16:33:56 +02:00
|
|
|
|
\let\tempone\itemize
|
|
|
|
|
\let\temptwo\enditemize
|
|
|
|
|
\renewenvironment{itemize}{\tempone\addtolength{\itemsep}{0.5\baselineskip}}{\temptwo}
|
|
|
|
|
|
2019-10-18 10:40:13 +02:00
|
|
|
|
|
|
|
|
|
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\newcommand{\sectiontitleframe}{
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\begin{frame}
|
|
|
|
|
\vfill
|
|
|
|
|
\centering
|
|
|
|
|
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
|
|
|
|
|
\usebeamerfont{title}\insertsectionhead\par%
|
|
|
|
|
\end{beamercolorbox}
|
|
|
|
|
\vfill
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\end{frame}}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
\lstdefinelanguage{gdb}{
|
|
|
|
|
morekeywords={gdb},
|
|
|
|
|
sensitive=false,
|
|
|
|
|
}
|
2019-10-17 16:18:08 +02:00
|
|
|
|
\lstdefinelanguage{cfiasm}{
|
|
|
|
|
morekeywords={cfi_startproc,cfi_def_cfa_offset,cfi_offset,cfi_def_cfa_register},
|
|
|
|
|
sensitive=false,
|
|
|
|
|
}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-18 10:40:13 +02:00
|
|
|
|
\newcommand{\thenalert}[1]{\only<1>{#1}\only<2>{\alert{#1}}}
|
|
|
|
|
\newcommand{\slidecountline}{
|
|
|
|
|
\ifthenelse{\theframenumber = 0}
|
|
|
|
|
{}
|
|
|
|
|
{\insertframenumber/\inserttotalframenumber}}
|
|
|
|
|
|
2019-10-14 16:53:16 +02:00
|
|
|
|
\setbeamertemplate{footline}
|
|
|
|
|
{
|
|
|
|
|
\leavevmode%
|
|
|
|
|
\hbox{%
|
|
|
|
|
\hskip0.9\paperwidth
|
|
|
|
|
%\begin{beamercolorbox}[wd=.4\paperwidth,ht=2.25ex,dp=1ex,center]{author in head/foot}%
|
|
|
|
|
% \usebeamerfont{author in head/foot}\insertshortauthor
|
|
|
|
|
%\end{beamercolorbox}%
|
|
|
|
|
\begin{beamercolorbox}[center, wd=.1\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
|
|
|
|
|
\slidecountline{}
|
|
|
|
|
\end{beamercolorbox}}%
|
|
|
|
|
\vskip0pt%
|
|
|
|
|
}
|
|
|
|
|
|
2019-10-18 10:40:13 +02:00
|
|
|
|
\setbeamercolor{block title}{use=structure,fg=white,bg=structure.fg!75!black}
|
|
|
|
|
\setbeamercolor{block title alerted}{use=alerted text,fg=white,bg=alerted
|
|
|
|
|
text.fg!75!black}
|
|
|
|
|
\setbeamercolor{block title example}{use=example text,fg=white,bg=example
|
|
|
|
|
text.fg!75!black}
|
|
|
|
|
|
|
|
|
|
%\setbeamertemplate{frametitle}{
|
|
|
|
|
% \leavevmode%
|
|
|
|
|
% \hbox{%
|
|
|
|
|
% \begin{beamercolorbox}[wd=\paperwidth,ht=2.25ex,dp=1ex,center]{title in head/foot}%
|
|
|
|
|
% \usebeamerfont{author in head/foot}\insertframetitle
|
|
|
|
|
% \end{beamercolorbox}%
|
|
|
|
|
% }
|
|
|
|
|
% \vskip0pt%
|
|
|
|
|
% %\color{black}\bfseries\insertframetitle\par\vskip-6pt\hrulefill
|
|
|
|
|
%}
|
|
|
|
|
|
2018-11-05 16:19:19 +01:00
|
|
|
|
|
|
|
|
|
\newcolumntype{b}{X}
|
|
|
|
|
\newcolumntype{s}{>{\hsize=.43\hsize}X}
|
|
|
|
|
|
|
|
|
|
\newcommand{\lstinl}
|
|
|
|
|
{\lstinline[language=C, keepspaces=true, basicstyle=\ttfamily]}
|
|
|
|
|
|
2018-10-26 15:42:37 +02:00
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2019-10-14 16:53:16 +02:00
|
|
|
|
\title[] {Reliable and Fast DWARF-based Stack Unwinding}
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\author[\slidecountline]{\alert{\textbf{Théophile Bastian}}\\
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\textbf{Stephen Kell} \\
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\textbf{Francesco Zappa Nardelli}}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\date{}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
%\subject{}
|
|
|
|
|
%\logo{}
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\institute{ENS Paris, University of Kent, Inria}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
\begin{document}
|
|
|
|
|
|
|
|
|
|
\begin{frame}
|
|
|
|
|
\addtocounter{framenumber}{-1}
|
|
|
|
|
\titlepage{}
|
|
|
|
|
|
|
|
|
|
\vspace{-2em}
|
|
|
|
|
|
2019-10-18 10:40:13 +02:00
|
|
|
|
|
2019-10-14 16:29:41 +02:00
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.55\textwidth}
|
|
|
|
|
\begin{tcolorbox}[halign=center, colframe=blue]
|
|
|
|
|
\textbf{Webpage} (incl. slides)
|
|
|
|
|
|
|
|
|
|
\smallskip
|
|
|
|
|
\vspace{0.5em}
|
2019-10-18 10:40:13 +02:00
|
|
|
|
{\small\url{https://huit.re/frdwarf}}\\
|
2019-10-14 16:29:41 +02:00
|
|
|
|
\vspace{0.5em}
|
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
\end{column}
|
|
|
|
|
|
|
|
|
|
\begin{column}{0.55\textwidth}
|
|
|
|
|
\begin{tcolorbox}[colframe=blue]
|
|
|
|
|
\begin{center}\textbf{Funding}\end{center}
|
|
|
|
|
\vspace{-1em}
|
|
|
|
|
|
|
|
|
|
\smallskip
|
2019-10-15 15:57:52 +02:00
|
|
|
|
ONR VerticA \\
|
2019-10-14 16:29:41 +02:00
|
|
|
|
Google Research Fellowship
|
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
2019-10-18 10:40:13 +02:00
|
|
|
|
|
|
|
|
|
\begin{textblock*}{0.22\textwidth}[0.5,0](0.15\paperwidth,0.38\paperheight)%
|
|
|
|
|
\includegraphics[width=\linewidth]{img/stephen_circ.jpg}
|
|
|
|
|
\end{textblock*}
|
|
|
|
|
\begin{textblock*}{0.22\textwidth}[0.5,0](0.85\paperwidth,0.38\paperheight)%
|
|
|
|
|
\includegraphics[width=\linewidth]{img/fzn_circ.jpg}
|
|
|
|
|
\end{textblock*}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\section{DWARF and stack unwinding data}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
\subsection{Introduction}
|
|
|
|
|
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\begin{frame}[fragile]{}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\begin{columns}[c]
|
2019-10-14 20:08:08 +02:00
|
|
|
|
\begin{column}{0.65\textwidth}
|
2019-10-15 12:13:55 +02:00
|
|
|
|
\begin{lstlisting}[basicstyle=\tt,language=gdb, numbers=none, escapechar=|]
|
2019-10-14 16:06:59 +02:00
|
|
|
|
$ ./a.out
|
|
|
|
|
Segmentation fault.
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-14 16:06:59 +02:00
|
|
|
|
|\pause|(gdb) backtrace
|
2019-10-14 20:16:20 +02:00
|
|
|
|
#0 |0x54625| in fct_b
|
|
|
|
|
#1 |\color{blue}0x54663| in fct_a
|
|
|
|
|
#2 |\color{red}0x54674| in main
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{lstlisting}
|
|
|
|
|
\pause{}
|
|
|
|
|
\begin{center}
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\textbf{\Large How does it work?}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{center}
|
|
|
|
|
\end{column}
|
|
|
|
|
\begin{column}{0.35\textwidth}
|
|
|
|
|
\pause{}
|
|
|
|
|
\includegraphics[width=0.95\linewidth]{img/call_stack}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
\subsection{Stack frames and unwinding}
|
|
|
|
|
|
2019-10-14 16:55:43 +02:00
|
|
|
|
\begin{frame}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\begin{columns}[c]
|
2019-10-14 20:08:08 +02:00
|
|
|
|
\begin{column}{0.65\textwidth}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\begin{center}
|
|
|
|
|
\large\bf
|
2019-10-19 07:14:07 +02:00
|
|
|
|
How do we get\\
|
|
|
|
|
the return address?
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
\vspace{2em}
|
|
|
|
|
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\onslide<2>{What if we only have \reg{rsp}?}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
\end{center}
|
|
|
|
|
\end{column}
|
2019-10-14 20:08:08 +02:00
|
|
|
|
\begin{column}{0.35\textwidth}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\includegraphics[width=0.95\linewidth]{img/call_stack}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
\subsection{DWARF tables}
|
|
|
|
|
|
|
|
|
|
\newcolumntype{a}{>{\columncolor{RedOrange}}l}
|
|
|
|
|
|
|
|
|
|
\begin{frame}{DWARF unwinding data}
|
|
|
|
|
\tt \footnotesize
|
2019-10-14 20:08:08 +02:00
|
|
|
|
\begin{center}
|
|
|
|
|
\begin{tabular}{
|
|
|
|
|
>{\columncolor{YellowGreen}}l
|
|
|
|
|
>{\columncolor{Thistle}}l
|
|
|
|
|
l l l l l l
|
|
|
|
|
>{\columncolor{Apricot}}l}
|
2019-10-15 15:57:52 +02:00
|
|
|
|
~PC & CFA & rbx & rbp & r12 & r13 & r14 & r15 & ra \\
|
2018-10-26 15:42:37 +02:00
|
|
|
|
0084950 & rsp+8 & u & u & u & u & u & u & c-8 \\
|
|
|
|
|
0084952 & rsp+16 & u & u & u & u & u & c-16 & c-8 \\
|
|
|
|
|
0084954 & rsp+24 & u & u & u & u & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084956 & rsp+32 & u & u & u & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084958 & rsp+40 & u & u & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084959 & rsp+48 & u & c-48 & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
\rowcolor{Aquamarine} 008495a & rsp+56 & c-56 & c-48 & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084962 & rsp+64 & c-56 & c-48 & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084a19 & rsp+56 & c-56 & c-48 & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084a1d & rsp+48 & c-56 & c-48 & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
|
|
|
|
0084a1e & rsp+40 & c-56 & c-48 & c-40 & c-32 & c-24 & c-16 & c-8 \\
|
2019-10-14 20:08:08 +02:00
|
|
|
|
\end{tabular}
|
|
|
|
|
\end{center}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-14 17:34:51 +02:00
|
|
|
|
\only<1>{\vspace{19mm}}
|
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.50\textwidth}
|
2019-10-17 16:33:56 +02:00
|
|
|
|
\onslide<2->{
|
2019-10-14 17:34:51 +02:00
|
|
|
|
\begin{tcolorbox}[enhanced, halign=center, frame hidden, colback=YellowGreen]
|
|
|
|
|
\textbf{For each instruction\ldots}\\
|
|
|
|
|
(identified by its program counter)
|
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
}
|
|
|
|
|
\end{column}
|
|
|
|
|
\begin{column}{0.50\textwidth}
|
2019-10-17 16:33:56 +02:00
|
|
|
|
\onslide<3->{
|
2019-10-14 17:34:51 +02:00
|
|
|
|
\begin{tcolorbox}[enhanced, halign=center, frame hidden,
|
|
|
|
|
interior style={right color=Apricot, left color=Thistle}]
|
|
|
|
|
\textbf{\ldots{}an expression to compute its return address
|
|
|
|
|
location on the stack}
|
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
\begin{frame}[t, fragile]{The real DWARF}
|
|
|
|
|
\begin{lstlisting}[numbers=none, language=]
|
2019-10-14 17:59:08 +02:00
|
|
|
|
30 24 34 FDE pc=004020..004040
|
2018-10-26 15:42:37 +02:00
|
|
|
|
DW_CFA_def_cfa_offset: 16
|
2019-10-14 17:59:08 +02:00
|
|
|
|
DW_CFA_advance_loc: 6 to 0000000000004026
|
2018-10-26 15:42:37 +02:00
|
|
|
|
DW_CFA_def_cfa_offset: 24
|
2019-10-14 17:59:08 +02:00
|
|
|
|
DW_CFA_advance_loc: 10 to 0000000000004030
|
|
|
|
|
DW_CFA_def_cfa_expression (DW_OP_breg7 (rsp): 8; DW_OP_breg16 (rip): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit11; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus)
|
2018-10-26 15:42:37 +02:00
|
|
|
|
[...]
|
|
|
|
|
\end{lstlisting}
|
|
|
|
|
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\pause{}
|
2019-10-17 16:18:08 +02:00
|
|
|
|
\vfill
|
2019-10-15 15:57:52 +02:00
|
|
|
|
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\begin{itemize}
|
2019-10-19 07:18:00 +02:00
|
|
|
|
\bf
|
|
|
|
|
\item[\textbf{$\longrightarrow$}] \alert{bytecode} for a
|
|
|
|
|
\alert{Turing-complete stack machine}
|
|
|
|
|
\item[\textbf{$\longrightarrow$}] which is \alert{interpreted on
|
|
|
|
|
demand at runtime}\\to reconstruct the table
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{itemize}
|
2019-10-17 16:18:08 +02:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
\begin{frame}{What does this imply?}
|
|
|
|
|
Your compiler actually generates codes for \alert{two machines}: your
|
|
|
|
|
processor and the DWARF VM\@.
|
|
|
|
|
|
|
|
|
|
\vfill{}
|
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.5\textwidth}
|
|
|
|
|
\begin{center}
|
|
|
|
|
\begin{tikzpicture}
|
|
|
|
|
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
|
|
|
|
\node (cmd) at (0, 2.5) {
|
|
|
|
|
\lstbash{\$ gcc -S foo.c}
|
|
|
|
|
};
|
|
|
|
|
\node (asm) at (0, 0) {
|
|
|
|
|
\lstinputlisting[numbers=none, language=cfiasm]{src/main_cfi.s}
|
|
|
|
|
};
|
|
|
|
|
\end{scope}
|
|
|
|
|
\begin{scope}[>={Stealth[black]},
|
|
|
|
|
every path/.style={draw=black,very thick}]
|
|
|
|
|
\path [->] (cmd) -- (asm);
|
|
|
|
|
\end{scope}
|
|
|
|
|
\end{tikzpicture}
|
|
|
|
|
\medskip{}
|
|
|
|
|
|
|
|
|
|
\textbf{The \lstc{.cfi_*} is inline DWARF!}
|
|
|
|
|
\end{center}
|
|
|
|
|
\end{column}
|
|
|
|
|
|
|
|
|
|
\begin{column}{0.5\textwidth}
|
|
|
|
|
\begin{center}
|
|
|
|
|
\bf
|
|
|
|
|
$\implies$ if you write inline asm, you must write inline DWARF!
|
|
|
|
|
\end{center}
|
|
|
|
|
|
|
|
|
|
In \prog{glibc}, \prog{lowlevellock.h}:
|
2019-10-17 16:29:18 +02:00
|
|
|
|
\alert{off by one error in unwinding data}.
|
2019-10-17 16:18:08 +02:00
|
|
|
|
|
|
|
|
|
\lstinputlisting[language=gdb,numbers=none]{src/lowlevellock_backtrace}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
|
|
|
|
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-15 12:13:55 +02:00
|
|
|
|
\only<2->{
|
2019-10-17 16:18:08 +02:00
|
|
|
|
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.10\paperheight)%
|
2019-10-15 12:13:55 +02:00
|
|
|
|
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
2019-10-17 16:29:18 +02:00
|
|
|
|
\bf \LARGE
|
2019-10-15 12:13:55 +02:00
|
|
|
|
Complex \,\& \,slow
|
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
\end{textblock*}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
\only<3->{
|
2019-10-17 16:18:08 +02:00
|
|
|
|
\begin{textblock*}{0.90\textwidth}[0.5,0](0.5\paperwidth,0.30\paperheight)%
|
2019-10-15 12:13:55 +02:00
|
|
|
|
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
2019-10-17 16:29:18 +02:00
|
|
|
|
\LARGE
|
|
|
|
|
\textbf{Pervasive:}\\ relied upon by profilers, debuggers,
|
2019-10-17 16:18:08 +02:00
|
|
|
|
aaand\ldots{}
|
|
|
|
|
\onslide<4->{
|
|
|
|
|
C++ exceptions. \\
|
|
|
|
|
\medskip{}
|
|
|
|
|
\textbf{$\leadsto$ not only for debuggers!}}
|
2019-10-15 12:13:55 +02:00
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
\end{textblock*}
|
|
|
|
|
}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
2018-11-08 19:37:04 +01:00
|
|
|
|
\newcommand{\LinusMailOne}{
|
2018-11-05 16:19:19 +01:00
|
|
|
|
``Sorry, but last time was too f\dots painful. The whole (and
|
|
|
|
|
only) point of unwinders is to make debugging easy
|
|
|
|
|
when a bug occurs. But \alert{the dwarf unwinder had bugs}
|
|
|
|
|
itself, or \alert{our dwarf information had bugs}, and in either
|
|
|
|
|
case it actually turned several trivial bugs into a \alert{total
|
|
|
|
|
undebuggable hell}.''
|
2018-11-08 19:37:04 +01:00
|
|
|
|
}
|
|
|
|
|
\newcommand{\LinusMailTwo}{
|
2018-11-05 16:19:19 +01:00
|
|
|
|
``If you can \alert{mathematically prove that the unwinder is
|
|
|
|
|
correct} — even in the presence of bogus and actively
|
|
|
|
|
incorrect unwinding information — and never ever
|
|
|
|
|
follows a bad pointer, \alert{I’ll reconsider}.''
|
2018-11-08 19:37:04 +01:00
|
|
|
|
}
|
|
|
|
|
\newcommand{\LinusSource}{
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\hfill ---~Linus Torvalds, 2012
|
2018-11-08 19:37:04 +01:00
|
|
|
|
}
|
2019-10-14 16:55:43 +02:00
|
|
|
|
\begin{frame}
|
2019-10-14 19:08:12 +02:00
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.75\textwidth}
|
|
|
|
|
\LinusMailOne{}
|
|
|
|
|
\end{column}
|
|
|
|
|
\begin{column}{0.25\textwidth}
|
|
|
|
|
\includegraphics[width=\textwidth]{img/roundtorvalds.png}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\only<1-2>{
|
|
|
|
|
\vspace{1em}
|
|
|
|
|
\LinusSource{}
|
|
|
|
|
}
|
|
|
|
|
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\vspace{1em}
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\only<2>{
|
|
|
|
|
\begin{center}
|
|
|
|
|
\Large\bf
|
|
|
|
|
\alert{This is where we still are!}
|
|
|
|
|
\end{center}
|
|
|
|
|
}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\only<3>{
|
|
|
|
|
\LinusMailTwo{}
|
|
|
|
|
|
|
|
|
|
\vspace{1em}
|
|
|
|
|
\LinusSource{}
|
|
|
|
|
}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\section{Correctness by construction:\\*\textbf{synthesis of unwinding tables}}
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\sectiontitleframe{}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
|
|
|
|
|
\newcommand{\tblrowval}[4]{#1 & #2 & \only<2->{#3} & \only<2->{#4} \\}
|
|
|
|
|
\newcommand{\blknote}[1]
|
|
|
|
|
{\begin{block}{}
|
|
|
|
|
\centering\large
|
|
|
|
|
#1
|
|
|
|
|
\end{block}}
|
|
|
|
|
\newcommand{\blklnote}[1]
|
|
|
|
|
{\begin{block}{}
|
|
|
|
|
\large
|
|
|
|
|
#1
|
|
|
|
|
\end{block}}
|
|
|
|
|
\newcommand{\tblhl}{\rowcolor{Tan}}
|
|
|
|
|
|
2019-10-14 16:55:43 +02:00
|
|
|
|
\begin{frame}
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\newcommand{\firsttblrows}{
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\tblrowval{\hspace{-2ex}<{\bf foo}>:}{}{\textbf{CFA}}{\textbf{ra}}
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\rowonly<4>{\tblhl{}} \tblrowval{push}{\%r15}{rsp+8}{c-8}
|
|
|
|
|
\rowonly<5>{\tblhl{}} \tblrowval{push}{\%r14}{rsp+16}{c-8}
|
|
|
|
|
\rowonly<6>{\tblhl{}} \tblrowval{mov}{\$0x3,\%eax}{rsp+24}{c-8}
|
|
|
|
|
\rowonly<7>{\tblhl{}} \tblrowval{push}{\%r13}{rsp+24}{c-8}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\tblrowval{push}{\%r12}{rsp+32}{c-8}
|
|
|
|
|
\tblrowval{push}{\%rbp}{rsp+40}{c-8}
|
|
|
|
|
\tblrowval{push}{\%rbx}{rsp+48}{c-8}
|
|
|
|
|
\tblrowval{sub}{\$0x68,\%rsp}{rsp+56}{c-8}
|
2018-11-06 12:52:05 +01:00
|
|
|
|
}
|
|
|
|
|
|
2019-10-15 10:43:04 +02:00
|
|
|
|
|
|
|
|
|
{\only<3>{
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\begin{textblock*}{\textwidth}[0.5,0.5](0.5\paperwidth,0.5\paperheight)%
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\begin{tcolorbox}[halign=center, colframe=red, colback=Lavender]
|
|
|
|
|
\large
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\alert{\bf Assumptions}
|
|
|
|
|
\vspace{0.6em}
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\begin{itemize}
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\item the compiler generated the unwinding data
|
|
|
|
|
\item we have a reliable DWARF interpreter
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\end{itemize}
|
2019-10-19 07:14:07 +02:00
|
|
|
|
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\end{tcolorbox}
|
|
|
|
|
\end{textblock*}
|
|
|
|
|
}}
|
|
|
|
|
\only<-9>{
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\begin{table}
|
|
|
|
|
\ttfamily\large
|
|
|
|
|
\begin{tabularx}{0.9\linewidth}{
|
|
|
|
|
l
|
|
|
|
|
b
|
|
|
|
|
>{\columncolor{SkyBlue}}s
|
|
|
|
|
>{\columncolor{SkyBlue}}s
|
|
|
|
|
}
|
|
|
|
|
\firsttblrows{}%
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\tblrowval{add}{\$0x68,\%rsp}{rsp+160}{c-8}
|
|
|
|
|
\tblrowval{pop}{\%rbx}{rsp+56}{c-8}
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\end{tabularx}
|
|
|
|
|
\end{table}
|
|
|
|
|
\blknote{
|
|
|
|
|
\centering
|
2019-10-17 16:29:18 +02:00
|
|
|
|
\begin{overlayarea}{0.9\textwidth}{2.6em}
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\only<4>{Upon function call, \alert{ra = *(\reg{rsp})}}
|
|
|
|
|
\only<5>{\texttt{push} decreases \reg{rsp} by 8: %
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\alert{ra = *(\reg{rsp} + 8)}}
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\only<6>{and again: %
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\alert{ra = *(\reg{rsp} + 16)}}
|
2019-10-17 16:29:18 +02:00
|
|
|
|
\only<7>{This \texttt{mov} leaves \reg{rsp} untouched: \\%
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\alert{ra = *(\reg{rsp} + 16)}}
|
2019-10-15 10:43:04 +02:00
|
|
|
|
\only<8>{The unwinding table captures an \alert{abstract execution}
|
2019-10-14 16:06:59 +02:00
|
|
|
|
of the code\ldots}
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\only<9>{\ldots and thus is \alert{redundant with the binary}.}
|
2018-11-06 12:52:05 +01:00
|
|
|
|
\end{overlayarea}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
2018-10-26 15:42:37 +02:00
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2018-11-14 10:13:19 +01:00
|
|
|
|
\section{Unwinding data synthesis from binaries}
|
|
|
|
|
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\begin{frame}{Synthesis strategy}
|
2019-10-11 11:57:32 +02:00
|
|
|
|
\begin{itemize}
|
2019-10-15 12:23:38 +02:00
|
|
|
|
\item Upon entering a function, we know
|
2018-11-07 08:50:04 +01:00
|
|
|
|
\[ \cfa = \reg{rsp} - 8
|
|
|
|
|
\qquad \ra = \cfa + 8 \]
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\item The semantics of each instruction specifies \alert{how it changes
|
|
|
|
|
the \cfa}.
|
2018-11-08 19:37:04 +01:00
|
|
|
|
\begin{itemize}
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\item Heuristic to decide whether we index with \reg{rbp} or
|
|
|
|
|
\reg{rsp}
|
2019-10-11 11:57:32 +02:00
|
|
|
|
\end{itemize}
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\item By performing \alert{symbolic execution} with an abstract
|
|
|
|
|
semantics, we can \alert{synthesize the
|
2019-10-14 16:06:59 +02:00
|
|
|
|
unwinding table} line by line.
|
|
|
|
|
\item Control flow: forward data-flow analysis
|
|
|
|
|
\item The fixpoints are immediate, cf article
|
2018-11-07 08:50:04 +01:00
|
|
|
|
\end{itemize}
|
2019-10-15 15:57:52 +02:00
|
|
|
|
|
2019-10-17 15:17:58 +02:00
|
|
|
|
\vspace{1em}
|
|
|
|
|
\begin{tcolorbox}[halign=center, colframe=OliveGreen, colback=YellowGreen]
|
|
|
|
|
\large
|
|
|
|
|
Implemented on top of CMU's \prog{BAP}
|
|
|
|
|
\end{tcolorbox}
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
2018-11-08 20:35:15 +01:00
|
|
|
|
\begin{frame}{}
|
|
|
|
|
\vfill
|
|
|
|
|
\centering
|
|
|
|
|
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
|
2019-10-15 10:44:37 +02:00
|
|
|
|
\Large
|
2018-11-08 20:35:15 +01:00
|
|
|
|
Demo time!
|
|
|
|
|
\end{beamercolorbox}
|
|
|
|
|
\vfill
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
2018-11-05 16:19:19 +01:00
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
\section{Unwinding data compilation}
|
|
|
|
|
|
2019-10-17 15:17:58 +02:00
|
|
|
|
\begin{frame}
|
|
|
|
|
\begin{center}
|
|
|
|
|
\Huge
|
|
|
|
|
Unwinding data is
|
2019-10-18 11:43:43 +02:00
|
|
|
|
\textsc{slo\pause{}o\pause{}o\pause{}o\pause{}o\pause{}o\pause{}o\pause{}o\pause{}w}.
|
2019-10-17 15:17:58 +02:00
|
|
|
|
\end{center}
|
|
|
|
|
\vspace{2em}
|
|
|
|
|
|
|
|
|
|
\pause{}
|
|
|
|
|
|
|
|
|
|
So much that \prog{perf} doesn't use it by default! You must use
|
|
|
|
|
\lstbash{perf report --call-graph dwarf} explicitly!
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\sectiontitleframe{}
|
|
|
|
|
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\subsection{Compilation ahead-of-time}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2019-10-14 16:55:43 +02:00
|
|
|
|
\begin{frame}[shrink]
|
2019-10-15 11:52:35 +02:00
|
|
|
|
\vspace{0.5cm}
|
|
|
|
|
\begin{tikzpicture}
|
|
|
|
|
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
|
|
|
|
\node (dwarf) at (0, 0) {
|
2019-10-15 12:13:55 +02:00
|
|
|
|
\lstinputlisting[basicstyle=\tiny\tt,numbers=none,language=]{src/dw_plt_abbr}
|
2019-10-15 11:52:35 +02:00
|
|
|
|
};
|
2019-10-08 12:13:01 +02:00
|
|
|
|
|
2019-10-17 15:21:32 +02:00
|
|
|
|
\onslide<2->{
|
2019-10-15 11:52:35 +02:00
|
|
|
|
\node (table) at (0.5\textwidth, -0.23\textheight) {
|
|
|
|
|
\tiny\tt
|
|
|
|
|
\begin{tabular}{
|
|
|
|
|
>{\columncolor{YellowGreen}}l
|
|
|
|
|
>{\columncolor{Thistle}}l
|
|
|
|
|
l l
|
|
|
|
|
>{\columncolor{Apricot}}l}
|
2019-10-15 15:57:52 +02:00
|
|
|
|
~PC & CFA & rbx & rbp & ra \\
|
2019-10-15 11:52:35 +02:00
|
|
|
|
0084950 & rsp+8 & u & u & c-8 \\
|
|
|
|
|
0084952 & rsp+16 & u & u & c-8 \\
|
|
|
|
|
0084954 & rsp+24 & u & u & c-8 \\
|
|
|
|
|
0084956 & rsp+32 & u & u & c-8 \\
|
|
|
|
|
\end{tabular}
|
|
|
|
|
};
|
|
|
|
|
}
|
2019-10-17 15:21:32 +02:00
|
|
|
|
\onslide<3->{
|
2019-10-15 11:52:35 +02:00
|
|
|
|
\node (csrc) at (0, -0.6\textheight) {
|
|
|
|
|
\lstinputlisting[basicstyle=\tiny,numbers=none,language=C]{src/fib7/fib7.eh_elf_basic.c}
|
|
|
|
|
};
|
|
|
|
|
\node (ehelf) at (0.55\textwidth, -0.75\textheight) {
|
|
|
|
|
ELF file:
|
|
|
|
|
``\ehelf{}''
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
\end{scope}
|
|
|
|
|
|
|
|
|
|
\begin{scope}[>={Stealth[black]},
|
|
|
|
|
every node/.style={fill=white,rectangle},
|
|
|
|
|
every path/.style={draw=black,very thick}]
|
|
|
|
|
\only<2->{\path [->] (dwarf) -| node {runtime} (table);}
|
|
|
|
|
\only<3->{
|
|
|
|
|
\path [->] (dwarf) edge node {ahead of time} (csrc);
|
|
|
|
|
\path [->] (csrc) -| node {gcc, AoT} (ehelf);
|
|
|
|
|
}
|
|
|
|
|
\end{scope}
|
|
|
|
|
\end{tikzpicture}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
|
2019-10-14 16:55:43 +02:00
|
|
|
|
\begin{frame}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\begin{itemize}
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\item \alert{libunwind}: most common library for
|
2018-10-26 15:42:37 +02:00
|
|
|
|
unwinding
|
|
|
|
|
|
|
|
|
|
\bigskip{}
|
|
|
|
|
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\item \alert{\texttt{libunwind-eh\_elf}}: modified version to support
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\ehelfs{}
|
|
|
|
|
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\item[$\leadsto$] Same API, almost \alert{``relink-and-play''} for existing projects!
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{itemize}
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2018-11-05 16:19:19 +01:00
|
|
|
|
\subsection{Results}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-14 16:06:59 +02:00
|
|
|
|
\begin{frame}{Performances}
|
2019-10-18 10:40:13 +02:00
|
|
|
|
\begin{center}
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\Large\bf Unwinding speedup vs.\ libunwind:
|
2019-10-18 10:40:13 +02:00
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.5\textwidth}
|
|
|
|
|
\alert{x15} on gzip
|
|
|
|
|
\end{column}
|
|
|
|
|
\begin{column}{0.5\textwidth}
|
|
|
|
|
\alert{x25} on hackbench
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
|
|
|
|
\end{center}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-18 10:40:13 +02:00
|
|
|
|
\vfill
|
2019-10-14 16:06:59 +02:00
|
|
|
|
|
2019-10-18 10:40:13 +02:00
|
|
|
|
\begin{center}
|
|
|
|
|
\Large\bf Space overhead vs. DWARF:\\
|
|
|
|
|
\alert{x2.6 -- x3}
|
|
|
|
|
\end{center}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2018-11-08 19:37:04 +01:00
|
|
|
|
\section*{Conclusion}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\setcounter{section}{0}
|
|
|
|
|
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\begin{frame}{}
|
|
|
|
|
\vfill
|
|
|
|
|
\centering
|
|
|
|
|
\begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
|
|
|
|
|
\Large
|
|
|
|
|
What's next?
|
|
|
|
|
\end{beamercolorbox}
|
|
|
|
|
\vfill
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
\begin{frame}{}
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\begin{itemize}
|
2019-10-15 12:00:37 +02:00
|
|
|
|
\item{} Synthesis + compare = verification of unwinding data!
|
2019-10-15 15:57:52 +02:00
|
|
|
|
\item{} Integrate synthesis into compilers \& debuggers\\
|
|
|
|
|
$\rightarrow$ support for inline assembly, fallback method, \ldots
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\item{} Integrate into \prog{perf} for online unwinding
|
|
|
|
|
\item{} Probably many more cool projects!
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\end{itemize}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
2019-10-08 12:00:43 +02:00
|
|
|
|
\vspace{1em}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
|
|
|
|
|
\begin{center}
|
2019-10-08 12:00:43 +02:00
|
|
|
|
Come and chat if interested! \texttt{:)}
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{center}
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
2019-10-18 11:34:17 +02:00
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
|
\section*{Extra slides}
|
|
|
|
|
|
|
|
|
|
\begin{frame}[noframenumbering]
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
\begin{frame}[noframenumbering]{Fixpoint upon control flow merge}
|
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.3\textwidth}
|
|
|
|
|
\begin{tikzpicture}
|
|
|
|
|
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
|
|
|
|
\node (if) at (0, 5) {\lstbash{if cnd}};
|
|
|
|
|
\node (then) at (-1, 3) { \lstbash{then A} };
|
|
|
|
|
\node (else) at (1, 3) { \lstbash{else B} };
|
|
|
|
|
\node (after) at (0, 1) { \lstbash{C} };
|
|
|
|
|
\end{scope}
|
|
|
|
|
\node [circle, thick, draw, minimum size=3em, color=red] (circafter) at (0, 1) {};
|
|
|
|
|
\begin{scope}[>={Stealth[black]}, every path/.style={draw=black,very thick}]
|
|
|
|
|
\path [->] (if) -- (then);
|
|
|
|
|
\path [->] (if) -- (else);
|
|
|
|
|
\path [->] (then) -- (after);
|
|
|
|
|
\path [->] (else) -- (after);
|
|
|
|
|
\end{scope}
|
|
|
|
|
\end{tikzpicture}
|
|
|
|
|
\end{column}
|
|
|
|
|
\begin{column}{0.6\textwidth}
|
|
|
|
|
\begin{center}
|
|
|
|
|
If eg.
|
|
|
|
|
\[
|
|
|
|
|
CFA(A) = c-48 \qquad CFA(B) = c-52
|
|
|
|
|
\]
|
|
|
|
|
no possible unwinding data for C, \alert{even for the
|
|
|
|
|
compiler}!
|
|
|
|
|
|
|
|
|
|
\vspace{1em}
|
|
|
|
|
Also, \alert{no possible clean function postlude}!
|
|
|
|
|
|
|
|
|
|
\vspace{2em}
|
|
|
|
|
$\implies$ $CFA(A) = CFA(B)$ and merge is immediate
|
|
|
|
|
\end{center}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
|
|
|
|
\begin{frame}[noframenumbering]{Fixpoint upon loop control flow merge}
|
|
|
|
|
\begin{columns}
|
|
|
|
|
\begin{column}{0.3\textwidth}
|
|
|
|
|
\begin{tikzpicture}
|
|
|
|
|
\begin{scope}[every node/.style={rectangle,thick,draw,scale=0.95}]
|
|
|
|
|
\node (inbound) at (0, 7) {\lstbash{A}};
|
|
|
|
|
\node (while) at (0, 5) {\lstbash{for i in ...}};
|
|
|
|
|
\node (do) at (0, 3) { \lstbash{do a = array[i]; B} };
|
|
|
|
|
\node (done) at (0, 1) { \lstbash{C} };
|
|
|
|
|
\end{scope}
|
|
|
|
|
\node [ellipse, thick, draw, minimum width=10em, minimum height=3em, color=red] (circafter) at (0, 3) {};
|
|
|
|
|
\begin{scope}[>={Stealth[black]}, every path/.style={draw=black,very thick}]
|
|
|
|
|
\path [->] (inbound) -- (while);
|
|
|
|
|
\path [->] (while) edge[bend right] (do);
|
|
|
|
|
\path [->] (do) -- (done);
|
|
|
|
|
\path [->] (do) edge[bend right] (while);
|
|
|
|
|
\end{scope}
|
|
|
|
|
\end{tikzpicture}
|
|
|
|
|
\end{column}
|
|
|
|
|
\begin{column}{0.6\textwidth}
|
|
|
|
|
\begin{center}
|
|
|
|
|
{\large\alert{Variable stack frame size!}}
|
|
|
|
|
|
|
|
|
|
\vspace{1em}
|
|
|
|
|
|
2019-10-19 07:14:07 +02:00
|
|
|
|
We cannot hope for a simple invariant\dots\\
|
2019-10-18 11:34:17 +02:00
|
|
|
|
but the compiler cannot
|
|
|
|
|
either.
|
|
|
|
|
|
|
|
|
|
\vspace{1em}
|
|
|
|
|
|
|
|
|
|
{
|
2019-10-19 07:14:07 +02:00
|
|
|
|
\large\alert{$\implies$} the compiler will\\
|
|
|
|
|
\alert{fallback to \reg{rbp}}\\
|
2019-10-18 11:34:17 +02:00
|
|
|
|
}
|
|
|
|
|
even with \lstbash{--fomit-frame-pointer}
|
|
|
|
|
\end{center}
|
|
|
|
|
\end{column}
|
|
|
|
|
\end{columns}
|
|
|
|
|
\end{frame}
|
|
|
|
|
|
2018-10-26 15:42:37 +02:00
|
|
|
|
\end{document}
|