From c97ab68a0b81e021731d64e39c829adc3b26249b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Bastian?= Date: Mon, 3 Sep 2018 19:10:35 +0200 Subject: [PATCH] Few corrections --- slides/slides.tex | 154 +++++++++++----------------------------------- 1 file changed, 35 insertions(+), 119 deletions(-) diff --git a/slides/slides.tex b/slides/slides.tex index 707070c..260675e 100644 --- a/slides/slides.tex +++ b/slides/slides.tex @@ -10,6 +10,7 @@ \usepackage{amssymb} \usepackage{booktabs} \usepackage{makecell} +\usepackage{ifthen} \usepackage{../shared/my_listings} %\usepackage{../shared/my_hyperref} @@ -23,12 +24,22 @@ \setbeamertemplate{navigation symbols}{} \newcommand{\thenalert}[1]{\only<1>{#1}\only<2>{\alert{#1}}} +\newcommand{\slidecountline}{ + \ifthenelse{\theframenumber = 0} + {} + {\insertframenumber/\inserttotalframenumber}} + + +\lstdefinelanguage{gdb}{ + morekeywords={gdb}, + sensitive=false, +} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\author[Théophile Bastian]{Théophile \textsc{Bastian} \\ +\author[\slidecountline]{Théophile \textsc{Bastian} \\ \small{Under supervision of Francesco Zappa Nardelli}} -\title{Internship defense, MPRI, M2} -\subtitle{Speeding up stack unwinding by compiling DWARF debugging data} +\title[DWARF unwinding data compilation] + {Speeding up stack unwinding by compiling DWARF debugging data} \date{March\ --\ August 2018} %\subject{} %\logo{} @@ -40,6 +51,7 @@ \addtocounter{framenumber}{-1} \titlepage{} + \vspace{-1em} \begin{center} Slides: \url{https://tobast.fr/m2/slides.pdf} \\ Report: \url{https://tobast.fr/m2/report.pdf} @@ -58,21 +70,18 @@ \subsection{Introduction} \begin{frame}[fragile]{We often use stack unwinding!} - \begin{lstlisting}[language=, numbers=none, escapechar=|] + \begin{lstlisting}[language=gdb, numbers=none, escapechar=|] Program received signal SIGSEGV, Segmentation fault. 0x0000555555554625 in fct_b (m=0x5c) at segfault.c:5 5 printf("%l\n", *m); -|\pause| -(gdb) backtrace +|\pause| (gdb) backtrace #0 0x0000555555554625 in fct_b (m=0x5c) at segfault.c:5 #1 0x0000555555554663 in fct_a (n=42) at segfault.c:10 #2 0x0000555555554674 in main () at segfault.c:14 -|\pause| -(gdb) frame 1 +|\pause| (gdb) frame 1 #1 0x0000555555554663 in fct_a (n=42) at segfault.c:10 10 fct_b((int*)(some_fct_a_var + 8)); -|\pause| -(gdb) print some_fct_a_var +|\pause| (gdb) print some_fct_a_var $1 = 84 \end{lstlisting} @@ -139,8 +148,7 @@ $1 = 84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{DWARF tables} -\begin{frame}[fragile]{DWARF unwinding data} - +\begin{frame}[fragile, shrink]{DWARF unwinding data} \begin{lstlisting}[numbers=none, language=] 00009b30 48 009b34 FDE cie=0000 pc=0084950..0084b37 LOC CFA rbx rbp r12 r13 r14 r15 ra @@ -211,7 +219,7 @@ $1 = 84 \vspace{2em} \begin{center} - \textbf{Debug data is not only for debugging} + \textbf{\Large{}Debug data is not only for debugging} \end{center} \end{frame} @@ -221,18 +229,6 @@ $1 = 84 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Compilation Strategy} -\begin{frame}[fragile]{Types} - Generated data: - \lstinputlisting[language=C]{src/unwind_context.c} - \pause{} - - \vspace{1em} - Function type: - \begin{lstlisting}[language=C] -unwind_context_t _eh_elf( - unwind_context_t, instruction_pointer_t); \end{lstlisting} -\end{frame} - \begin{frame}{Compilation overview} \begin{itemize} \item Compiled to \alert{C code} @@ -265,39 +261,19 @@ unwind_context_t _eh_elf( \item Only supports few common expressions: already $~ 90\,\%$ of expressions used \end{itemize} + \item Among \alert{4000} randomly sampled filed, only \alert{24} + containing unsupported instructions \end{itemize} \end{frame} -\begin{frame}[fragile]{A word on memory maps} - \textbf{Various functions come from various ELFs}\\ - \pause{} - \hfill{}\textbf{\ldots{}and thus various \ehelfs{}} - - \begin{lstlisting}[language=, numbers=none] -55c81b11e000-55c81b126000 000k /usr/bin/cat -55c81b325000-55c81b326000 007k /usr/bin/cat -55c81b326000-55c81b327000 008k /usr/bin/cat -55c81bcf3000-55c81bd14000 000k [heap] -7f8a5b4ed000-7f8a5b50f000 000k /usr/lib/libc-2.28.so -7f8a5b50f000-7f8a5b65a000 022k /usr/lib/libc-2.28.so -7f8a5b65a000-7f8a5b6a6000 16dk /usr/lib/libc-2.28.so -7f8a5b6ec000-7f8a5b6ee000 000k /usr/lib/ld-2.28.so -7f8a5b6ee000-7f8a5b70d000 002k /usr/lib/ld-2.28.so -7f8a5b70d000-7f8a5b715000 021k /usr/lib/ld-2.28.so -7ffc8a66b000-7ffc8a68c000 000k [stack] -7ffc8a74a000-7ffc8a74d000 000k [vvar] -7ffc8a74d000-7ffc8a74f000 000k [vdso] - \end{lstlisting} -\end{frame} - %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \subsection{Outlining} \begin{frame}{Size optimisation: outlining} \begin{itemize} \item This \alert{works}, but \alert{takes space}: about \alert{7 times - heavier} than regular DWARF\@. + larger in size} than regular DWARF\@. \item DWARF optimisation strategy: \alert{alter previous row}. \\ Causes slowness: we cannot do that. @@ -341,7 +317,8 @@ unwind_context_t _eh_elf( \pause{}\vspace{1em} \begin{itemize} - \item 2 $\implies$ exit hand-crafted program, exit CSmith + \item 2 $\implies$ exit hand-crafted program. CSmith did not work + either. \item 5 $\implies$ cannot call the unwinding procedure by hand \end{itemize} \end{frame} @@ -387,6 +364,7 @@ unwind_context_t _eh_elf( \end{itemize} \end{frame} +\subsection{Libunwind} \begin{frame}{libunwind implementation} \begin{itemize} \item \alert{libunwind}: \textit{de facto} standard library for @@ -441,87 +419,27 @@ unwind_context_t _eh_elf( \begin{tabular}{r r r r r r} \toprule \thead{Object} - & \thead{Original \\ program size \\ (KiB)} - & \thead{Original \\ \lstc{.eh\_frame} \\ (KiB)} - & \thead{Generated \\ \ehelf{} \\ (KiB)} - & \thead{\% \\ original \\ size} - & \thead{Growth \\ factor} \\ + & \thead{\% of binary size} + & \thead{Growth factor} \\ \midrule libc - & 1\,434 & 130.1 & 313.2 & 21.88 & 2.41 \\ + & 21.88 & 2.41 \\ libpthread - & 58.1 & 11.6 & 25.4 & 43.71 & 2.19 \\ + & 43.71 & 2.19 \\ ld - & 129.6 & 9.6 & 28.6 & 22.09 & 2.97 \\ + & 22.09 & 2.97 \\ hackbench - & 2.9 & 0.555 & 2.8 & 93.87 & 4.99 \\ + & 93.87 & 4.99 \\ Total - & 1\,638 & 151.8 & 370.0 & 22.81 & \alert{2.44} \\ + & 22.81 & \alert{2.44} \\ \bottomrule \end{tabular} \end{center} \end{frame} -\newcommand{\ofsupp}[1]{$\left[\text{#1}\right]$} -\begin{frame}{Instructions coverage} - \scriptsize\centering - \begin{tabular}{r r r r r r} - \toprule - \thead{} - & \thead{Undef} - & \thead{Same \\ value} - & \thead{Offset} - & \thead{Val \\ offset} - & \thead{Reg} - \\ - \midrule - \makecell{Only supp. \\ columns} \vspace{.4em} - & 1698 (0.006\,\%) - & 0 - & 30\,M (99.9\,\%) - & 0 - & 14 (0\,\%) - \\ - All columns - & 1698 (0.003\,\%) - & 0 - & 55\,M (99.9\,\%) - & 0 - & 22 (0\,\%) - \\ - \bottomrule - \toprule - \thead{} - & \thead{Expr \\ \ofsupp{supported}} - & \thead{Val \\ expr} - & \thead{Archi.} - & & \thead{Total} - \\ - \midrule - \makecell{Only supp. \\ columns} \vspace{.4em} - & \makecell{4475 (0.015\,\%) \\ \ofsupp{81.4\,\%}} - & 0 - & 0 - & & 30044442 - \\ - All columns - & \makecell{12367 (0.02\,\%) \\ \ofsupp{91.7\,\%}} - & 0 - & 0 - & & 54680492 - \\ - - \bottomrule - \end{tabular} - - \vspace{2em}\pause{} - - \textbf{Among \alert{4000} randomly sampled filed, only \alert{24} - containing unsupported instructions} -\end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section{A glance at future work} +\section*{} \begin{frame}{What next?} \begin{itemize} @@ -540,8 +458,6 @@ unwind_context_t _eh_elf( \end{frame} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -\section*{} - \begin{frame} \begin{columns}[c] \begin{column}{0.35\textwidth}