diff options
Diffstat (limited to 'chap/chap4.tex')
-rw-r--r-- | chap/chap4.tex | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/chap/chap4.tex b/chap/chap4.tex index 455e2b6..6c058f1 100644 --- a/chap/chap4.tex +++ b/chap/chap4.tex @@ -37,6 +37,55 @@ CSF\supercite{context-sensitive-fencing} 中的译码级信息流追踪框架 DI 断是否需要插入 fence 微码。OISA\supercite{oisa} 在指令系统的定义中即包 含了 DIFT 技术,用于追踪一个数据是否为秘密数据。 +以图\ref{lst:spectre_v1}的 Spectre v1 组件代码为例,这段代码产生 +图\ref{lst:spectre_v1_asm}所示的指令。 + +\begin{figure}[htbp] +\begin{minted}[frame=single,linenos=true]{nasm} + xor eax, eax + cmp qword [rip + 0x2b157f], rdi + jbe loc.funcret + lea rax, [rip + 0x2b14ae] + add rax, rdi + movzx eax, byte [rax] + shl eax, 12 + lea rdx, [rip + 0x2b425d] + mov eax, dword [rdx + rax] + loc.funcret: ret +\end{minted} +\caption{Spectre 组件的汇编代码} +\label{lst:spectre_v1_asm} +\end{figure} + +这些指令中,在分支后执行的指令,DIFT 的行为如表\ref{tab:spectre_dift}所示。 + +\begin{table} +\begin{tabular}{|c|c|c|} +\hline +指令 & 指令的语义 & DIFT 行为\tabularnewline +\hline +\hline +lea rax, {[}rip + 0x2b14ae{]} & rax <- rip + 0x2b14ae & T{[}rax{]} <- T{[}rip{]} = 0\tabularnewline +\hline +add rax, rdi & rax <- rax + rdi & T{[}rax{]} <- T{[}rax{]} | T{[}rdi{]} = 0\tabularnewline +\hline +\multirow{2}{*}{movzx eax, byte {[}rax{]}} & \multirow{2}{*}{eax <- (uint8\_t){[}eax{]}} & T{[}rax{]} = 0, 指令安全\tabularnewline +\cline{3-3} + & & T{[}rax{]} <- 1\tabularnewline +\hline +shl eax, 12 & eax <- eax {*} 4096 & T{[}rax{]} <- T{[}rax{]} = 1\tabularnewline +\hline +lea rdx, {[}rip + 0x2b425d{]} & rdx <- rip + 0x2b425d & T{[}rdx{]} <- T{[}rip{]} = 0\tabularnewline +\hline +\multirow{2}{*}{eax, dword {[}rdx + rax{]}} & \multirow{2}{*}{eax <- {[}rdx + rax{]}} & (T{[}rdx{]} | T{[}rax{]}) = 1, 指令不安全 \tabularnewline +\cline{3-3} + & & T{[}rax{]} <- 1\tabularnewline +\hline +\end{tabular} +\caption{分支中代码产生的 DIFT 行为} +\label{tab:spectre_dift} +\end{table} + 本文使用 DIFT 检测 Spectre 组件中泄露数据的 load 指令。详细设计如下: \Todo: 解释为什么使用这种方法,和其他相似方法(DLIFT, TPBuf, SG(Full))的比较 |