Start DBI chapter
This commit is contained in:
@@ -54,6 +54,12 @@ encoding=UTF-8
|
||||
highlight=LaTeX
|
||||
mode=LaTeX
|
||||
|
||||
[item:inc/2.dynamorio.tex]
|
||||
archive=true
|
||||
encoding=UTF-8
|
||||
highlight=LaTeX
|
||||
mode=LaTeX
|
||||
|
||||
[item:inc/6.implementation.tex]
|
||||
archive=true
|
||||
encoding=UTF-8
|
||||
|
||||
39
doc.bib
39
doc.bib
@@ -1,8 +1,33 @@
|
||||
@Article{ weiser91,
|
||||
title = "{The Computer for the 21st Century}",
|
||||
author = "Mark Weiser",
|
||||
journal = "Scientific American",
|
||||
pages = "94--104",
|
||||
month = sep,
|
||||
year = "1991"
|
||||
@Article{Bruening2003,
|
||||
author = {Bruening, D. and Garnett, T. and Amarasinghe, S.},
|
||||
journal = {International Symposium on Code Generation and Optimization, 2003. CGO 2003.},
|
||||
title = {An infrastructure for adaptive dynamic optimization},
|
||||
year = {2003},
|
||||
doi = {10.1109/CGO.2003.1191551},
|
||||
}
|
||||
|
||||
@Article{Bruening2004,
|
||||
author = {Bruening, D.},
|
||||
journal = {Massachusetts Institute of Technology},
|
||||
title = {Efficient, transparent, and comprehensive runtime code manipulation},
|
||||
year = {2004},
|
||||
}
|
||||
|
||||
@InProceedings{Abel19a,
|
||||
author = {Abel, Andreas and Reineke, Jan},
|
||||
booktitle = {ASPLOS},
|
||||
title = {uops.info: Characterizing Latency, Throughput, and Port Usage of Instructions on Intel Microarchitectures},
|
||||
year = {2019},
|
||||
address = {New York, NY, USA},
|
||||
pages = {673--686},
|
||||
publisher = {ACM},
|
||||
series = {ASPLOS '19},
|
||||
acmid = {3304062},
|
||||
doi = {10.1145/3297858.3304062},
|
||||
isbn = {978-1-4503-6240-5},
|
||||
location = {Providence, RI, USA},
|
||||
numpages = {14},
|
||||
url = {http://doi.acm.org/10.1145/3297858.3304062},
|
||||
}
|
||||
|
||||
@Comment{jabref-meta: databaseType:bibtex;}
|
||||
|
||||
5
doc.tex
5
doc.tex
@@ -159,6 +159,11 @@
|
||||
\input{inc/1.introduction}
|
||||
\newpage
|
||||
\clearpage
|
||||
|
||||
\input{inc/2.dynamorio}
|
||||
\newpage
|
||||
\clearpage
|
||||
|
||||
\input{inc/6.implementation}
|
||||
\newpage
|
||||
\clearpage
|
||||
|
||||
107
img/dynamorio.tikz
Normal file
107
img/dynamorio.tikz
Normal file
@@ -0,0 +1,107 @@
|
||||
\begin{tikzpicture}
|
||||
\begin{pgfonlayer}{nodelayer}
|
||||
\node [style=none] (0) at (0, -2.5) {Multithreaded Application};
|
||||
\node [style=none] (1) at (-2, -1.75) {};
|
||||
\node [style=none] (2) at (-2, -3.25) {};
|
||||
\node [style=none] (3) at (2, -3.25) {};
|
||||
\node [style=none] (4) at (2, -1.75) {};
|
||||
\node [style=none] (5) at (-6, -1.75) {};
|
||||
\node [style=none] (6) at (6, -1.75) {};
|
||||
\node [style=none] (7) at (6, -3.25) {};
|
||||
\node [style=none] (8) at (-6, -3.25) {};
|
||||
\node [style=none] (9) at (-8.5, -5) {};
|
||||
\node [style=none] (10) at (9.75, -5) {};
|
||||
\node [style=none] (11) at (9.75, -13.5) {};
|
||||
\node [style=none] (12) at (-8.5, -13.5) {};
|
||||
\node [style=align text] (13) at (-7.25, -9.25) {Kernel-meditated\\Control Transfers};
|
||||
\node [style=os] (14) at (0, -15.5) {Operating System};
|
||||
\node [style=hardware] (15) at (0, -16.5) {Hardware};
|
||||
\node [style=dispatch] (16) at (0, -6.75) {Dispatch};
|
||||
\node [style=bb builder] (17) at (6, -6.75) {Basic Block\\Builder};
|
||||
\node [style=code cache] (19) at (0, -11.75) {Code Cache};
|
||||
\node [style=none] (20) at (2.25, -6.5) {};
|
||||
\node [style=none] (21) at (2.25, -7) {};
|
||||
\node [style=none] (22) at (3.75, -6.5) {};
|
||||
\node [style=none] (23) at (3.75, -7) {};
|
||||
\node [style=none] (24) at (-0.25, -8) {};
|
||||
\node [style=none] (25) at (0.25, -8) {};
|
||||
\node [style=none] (26) at (-0.25, -10.5) {};
|
||||
\node [style=none] (27) at (0.25, -10.5) {};
|
||||
\node [style=none] (28) at (-3, -8.75) {};
|
||||
\node [style=none] (29) at (9, -8.75) {};
|
||||
\node [style=none] (30) at (9, -9.75) {};
|
||||
\node [style=none] (31) at (-3, -9.75) {};
|
||||
\node [style=none] (32) at (3, -9.25) {Context Switch};
|
||||
\node [style=none] (33) at (-4, -3.25) {};
|
||||
\node [style=none] (34) at (0, -3.25) {};
|
||||
\node [style=none] (35) at (4, -3.25) {};
|
||||
\node [style=none] (36) at (0, -5.5) {};
|
||||
\node [style=none] (37) at (0.5, -5.5) {};
|
||||
\node [style=none] (38) at (-0.5, -5.5) {};
|
||||
\node [style=none] (39) at (-0.25, -13) {};
|
||||
\node [style=none] (40) at (0.25, -13) {};
|
||||
\node [style=none] (41) at (-0.25, -15) {};
|
||||
\node [style=none] (42) at (0.25, -15) {};
|
||||
\node [style=none] (43) at (-2.25, -6.75) {};
|
||||
\node [style=none] (44) at (-2.25, -7.25) {};
|
||||
\node [style=none] (45) at (-2.25, -6.25) {};
|
||||
\node [style=none] (46) at (-4.25, -7.25) {};
|
||||
\node [style=none] (47) at (-4.75, -6.75) {};
|
||||
\node [style=none] (48) at (-5.25, -6.25) {};
|
||||
\node [style=none] (49) at (-5.25, -15) {};
|
||||
\node [style=none] (50) at (-4.75, -15) {};
|
||||
\node [style=none] (51) at (-4.25, -15) {};
|
||||
\node [style=none] (52) at (-5, -3.25) {};
|
||||
\node [style=none] (53) at (-1, -3.25) {};
|
||||
\node [style=none] (54) at (3, -3.25) {};
|
||||
\node [style=none] (55) at (-2.25, -11.5) {};
|
||||
\node [style=none] (56) at (-2.25, -12) {};
|
||||
\node [style=none] (57) at (-3, -11.5) {};
|
||||
\node [style=none] (58) at (-3, -12) {};
|
||||
\node [style=none] (59) at (2.75, -14.25) {System Calls};
|
||||
\end{pgfonlayer}
|
||||
\begin{pgfonlayer}{edgelayer}
|
||||
\draw [style=block] (6.center)
|
||||
to (7.center)
|
||||
to (3.center)
|
||||
to (2.center)
|
||||
to (8.center)
|
||||
to (5.center)
|
||||
to (1.center)
|
||||
to (4.center)
|
||||
to cycle;
|
||||
\draw [style=dashed line] (1.center) to (2.center);
|
||||
\draw [style=dashed line] (4.center) to (3.center);
|
||||
\draw [style=kernel] (11.center)
|
||||
to (10.center)
|
||||
to (9.center)
|
||||
to (12.center)
|
||||
to cycle;
|
||||
\draw [style=latex arrow] (20.center) to (22.center);
|
||||
\draw [style=latex arrow] (23.center) to (21.center);
|
||||
\draw [style=context switch] (30.center)
|
||||
to (31.center)
|
||||
to (28.center)
|
||||
to (29.center)
|
||||
to cycle;
|
||||
\draw [style=latex arrow] (24.center) to (26.center);
|
||||
\draw [style=latex arrow] (27.center) to (25.center);
|
||||
\draw [style=latex arrow] (33.center) to (38.center);
|
||||
\draw [style=latex arrow] (34.center) to (36.center);
|
||||
\draw [style=latex arrow] (35.center) to (37.center);
|
||||
\draw [style=latex arrow] (39.center) to (41.center);
|
||||
\draw [style=latex arrow] (42.center) to (40.center);
|
||||
\draw [style=latex arrow] (48.center) to (45.center);
|
||||
\draw [style=latex arrow] (47.center) to (43.center);
|
||||
\draw [style=latex arrow] (46.center) to (44.center);
|
||||
\draw (48.center) to (49.center);
|
||||
\draw (47.center) to (50.center);
|
||||
\draw (46.center) to (51.center);
|
||||
\draw [style=latex arrow dashed] (48.center) to (52.center);
|
||||
\draw [style=latex arrow dashed] (47.center) to (53.center);
|
||||
\draw [style=latex arrow dashed] (46.center) to (54.center);
|
||||
\draw (56.center) to (58.center);
|
||||
\draw (58.center) to (57.center);
|
||||
\draw [style=latex arrow] (57.center) to (55.center);
|
||||
\end{pgfonlayer}
|
||||
\end{tikzpicture}
|
||||
@@ -13,6 +13,12 @@
|
||||
\tikzstyle{target socket}=[fill=white, draw=black, shape=rectangle, minimum width=2mm, minimum height=5mm]
|
||||
\tikzstyle{cache}=[fill=white, draw=black, shape=rectangle, minimum height=8mm, minimum width=2cm]
|
||||
\tikzstyle{l3cache}=[fill=white, draw=black, shape=rectangle, minimum height=2.5cm, minimum width=2cm]
|
||||
\tikzstyle{dispatch}=[fill={rgb,255: red,254; green,254; blue,174}, draw=black, shape=rectangle, minimum height=1.25cm, minimum width=2.25cm]
|
||||
\tikzstyle{bb builder}=[fill={rgb,255: red,174; green,254; blue,174}, draw=black, shape=rectangle, minimum height=1.25cm, align=center, minimum width=2.25cm]
|
||||
\tikzstyle{code cache}=[fill={rgb,255: red,174; green,169; blue,254}, draw=black, shape=rectangle, minimum height=1.25cm, minimum width=2.25cm]
|
||||
\tikzstyle{os}=[fill={rgb,255: red,207; green,207; blue,207}, draw=black, shape=rectangle, minimum width=6cm]
|
||||
\tikzstyle{hardware}=[fill={rgb,255: red,174; green,169; blue,174}, draw=black, shape=rectangle, minimum width=6cm]
|
||||
\tikzstyle{align text}=[fill=none, draw=none, rotate=90, align=center]
|
||||
|
||||
% Edge styles
|
||||
\tikzstyle{dashed line}=[-, dashed]
|
||||
@@ -22,3 +28,7 @@
|
||||
\tikzstyle{inner block}=[-, fill={rgb,255: red,199; green,213; blue,255}, thick, draw={rgb,255: red,60; green,106; blue,255}]
|
||||
\tikzstyle{dotted line}=[-, dotted]
|
||||
\tikzstyle{arrow without head}=[-, thick]
|
||||
\tikzstyle{kernel}=[-, draw=red, fill={rgb,255: red,254; green,169; blue,174}]
|
||||
\tikzstyle{latex arrow}=[-, -latex]
|
||||
\tikzstyle{context switch}=[-, dashed, fill={rgb,255: red,222; green,222; blue,222}]
|
||||
\tikzstyle{latex arrow dashed}=[-, -latex, dashed]
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sit amet ante elit. Etiam vel pharetra orci. Integer mollis auctor ante, non lacinia turpis lacinia eget. Vestibulum in orci ligula, tempor fringilla ipsum. Phasellus scelerisque elementum mauris iaculis euismod. Morbi a neque cursus turpis varius lobortis nec sed lorem. Nullam non nisi purus, eget ullamcorper urna. Proin dignissim, lacus id convallis tristique, metus felis pellentesque purus, at hendrerit lacus turpis eu justo. Quisque semper pretium turpis eu tempus. Nunc vehicula, erat et auctor blandit, elit augue ultrices tortor, id lacinia mi ligula et risus. Praesent mauris massa, porttitor ac rhoncus vitae, porta vitae elit.
|
||||
|
||||
Morbi in quam dolor, nec eleifend turpis. Phasellus consequat scelerisque purus, eget iaculis leo condimentum eu. Curabitur non augue non enim adipiscing interdum a a risus. Morbi commodo magna ultrices nisi adipiscing eu laoreet ante molestie. In hac habitasse platea dictumst. Sed nulla nulla, gravida eu ultricies vitae, venenatis quis dui. Nam cursus lectus eu nisi facilisis tristique. Praesent vulputate neque ut ligula convallis nec consequat enim semper. Nullam at lorem sit amet est rutrum convallis non eu ligula. Proin gravida tincidunt nibh, quis suscipit lacus convallis eget. Aenean id mi in lorem accumsan fermentum. Fusce.
|
||||
\cite{weiser91}
|
||||
\cite{Bruening2004}
|
||||
\cite{Bruening2003}
|
||||
|
||||
\begin{listing}[H]
|
||||
\begin{cppcode}
|
||||
|
||||
42
inc/2.dynamorio.tex
Normal file
42
inc/2.dynamorio.tex
Normal file
@@ -0,0 +1,42 @@
|
||||
\section{DynamoRIO}
|
||||
\label{sec:dynamorio}
|
||||
|
||||
This section will give a short overview of the dynamic binary instrumentation tool DynamoRIO, which will be used throughout this thesis.
|
||||
|
||||
\subsection{Dynamic Binary Instrumentation}
|
||||
\label{sec:dbi}
|
||||
|
||||
\revabbr{Dynamic binary instrumentation}{DBI} is a method for analyzing and manipulating the behavior of a binary application while it is running.
|
||||
This is achieved through the injection of additional instructions into the instruction trace of the target application.
|
||||
|
||||
Debuggers on the other hand, use special breakpoint instructions (e.g. INT3 on x86 or BKPT on ARM) that get injected at specific places in the code.
|
||||
When reaching those breakpoint instructions, a context switch to the operating system kernel will be performed, however, those context switches, result in a significant performance penalty as the processor state has to be saved and restored afterwards. (TODO irgendwie literatur referenz hier)
|
||||
|
||||
Because the instrumentation tool runs in the same process as the application, it is important that it operates transparently, meaning that it will not affect the application behavior in unintended ways.
|
||||
This is a special challenge as the dynamic instrumentation is not allowed to use the same memory routines or input/output buffering as the application \cite{Bruening2003}.
|
||||
|
||||
In contrast to static code analysis, which cannot predict the execution path of the program, the full runtime information is available to the dynamic instrumentation.
|
||||
|
||||
So DBI can be a mature choice for examining the runtime behavior of a binary application in a performant way.
|
||||
|
||||
The following section \ref{sec:dynamorio_core} will explain how the core functionality of the DBI tool DynamoRIO works.
|
||||
|
||||
\subsection{DynamoRIO Core}
|
||||
\label{sec:dynamorio_core}
|
||||
|
||||
% vlt auf transparenz eingehen wie dies gelöst wird.
|
||||
\input{img/thesis.tikzstyles}
|
||||
\begin{figure}[!ht]
|
||||
\begin{center}
|
||||
\tikzfig{img/dynamorio}
|
||||
\caption{DynamoRIO runtime code manipulation layer \cite{Bruening2003}.}
|
||||
\label{fig:dynamorio}
|
||||
\end{center}
|
||||
\end{figure}
|
||||
|
||||
\subsection{DynamoRIO Client}
|
||||
\label{sec:dynamorio_client}
|
||||
|
||||
|
||||
\subsection{DynamoRIO API}
|
||||
\label{sec:dynamorio_api}
|
||||
@@ -35,7 +35,7 @@ The \revabbr{inter-process communication}{IPC} between the two parts is achieved
|
||||
Figure \ref{fig:drcachesim} illustrates the structure of the individual parts.
|
||||
|
||||
\input{img/thesis.tikzstyles}
|
||||
\begin{figure}
|
||||
\begin{figure}[!ht]
|
||||
\begin{center}
|
||||
\tikzfig{img/drcachesim}
|
||||
\caption{Structure of the DrCacheSim online tracing.}
|
||||
|
||||
Reference in New Issue
Block a user