Compare commits

...

45 Commits

Author SHA1 Message Date
b792054325 Update on Overleaf. 2022-05-27 11:51:10 +00:00
0ea5063cca Update on Overleaf. 2022-05-27 09:41:11 +00:00
b7c93316c3 Update on Overleaf. 2022-05-27 08:25:07 +00:00
1a6f0a28d4 Update on Overleaf. 2022-05-27 08:21:21 +00:00
4c0931e534 Update on Overleaf. 2022-05-27 08:16:40 +00:00
70b1e39300 Update on Overleaf. 2022-05-27 08:12:50 +00:00
0ca8891223 Update on Overleaf. 2022-05-27 08:09:31 +00:00
c13306a45f Update on Overleaf. 2022-05-27 08:03:23 +00:00
7e53b07257 Update on Overleaf. 2022-05-27 07:55:06 +00:00
dc8fab96d0 Update on Overleaf. 2022-05-27 07:51:26 +00:00
1c2918abb0 Update on Overleaf. 2022-05-27 07:46:45 +00:00
f62a549029 Update on Overleaf. 2022-05-27 07:31:45 +00:00
f2c5f8b5ab Update on Overleaf. 2022-05-27 05:41:10 +00:00
a6c67aa804 Update on Overleaf. 2022-05-27 01:21:09 +00:00
a1d28370a8 Update on Overleaf. 2022-05-26 23:13:24 +00:00
a7f71bad2c Update on Overleaf. 2022-05-26 23:10:32 +00:00
782e96bd81 Update on Overleaf. 2022-05-26 23:08:33 +00:00
b9f23d52c1 Update on Overleaf. 2022-05-26 21:10:15 +00:00
082659a847 Update on Overleaf. 2022-05-26 19:00:15 +00:00
6041cf6e9b Update on Overleaf. 2022-05-26 16:50:15 +00:00
8335018d91 Update on Overleaf. 2022-05-26 14:40:15 +00:00
4975483673 Update on Overleaf. 2022-05-26 10:20:15 +00:00
41322b06c0 Update on Overleaf. 2022-05-25 15:41:30 +00:00
c2fa474782 Update on Overleaf. 2022-05-25 07:36:26 +00:00
3f3a1e2159 Update on Overleaf. 2022-05-25 06:38:14 +00:00
a4649caebd Update on Overleaf. 2022-05-25 02:41:32 +00:00
fdbdbe7fc4 Update on Overleaf. 2022-05-24 18:41:08 +00:00
2962228b67 Update on Overleaf. 2022-05-24 02:21:08 +00:00
cdc5290964 Update on Overleaf. 2022-05-23 10:11:05 +00:00
8534c6ad81 Update on Overleaf. 2022-05-23 07:20:11 +00:00
53f3a110e0 Update on Overleaf. 2022-05-23 06:30:24 +00:00
3321cb5e91 Update on Overleaf. 2022-05-22 23:10:39 +00:00
379b262ce6 added example src 2022-05-22 22:56:45 +01:00
f4918c8272 Update on Overleaf. 2022-05-22 21:55:05 +00:00
0d6777d837 Update on Overleaf. 2022-05-19 21:50:21 +00:00
e0746ba1cb Update on Overleaf. 2022-05-19 14:07:39 +00:00
5be6c1b041 Update on Overleaf. 2022-05-19 13:42:20 +00:00
86883bd2a1 Update on Overleaf. 2022-05-18 21:25:59 +00:00
1b9214dcb7 Update on Overleaf. 2022-05-18 05:30:21 +00:00
56dc15f918 Update on Overleaf. 2022-05-17 21:22:37 +00:00
70596588ff Update on Overleaf. 2022-05-17 17:22:23 +00:00
d61fb34eac Update on Overleaf. 2022-05-16 16:59:51 +00:00
240ce715dd Update on Overleaf. 2022-05-15 15:54:24 +00:00
7d24c222e4 Update on Overleaf. 2022-05-15 15:51:49 +00:00
2235afad85 Update on Overleaf. 2022-05-15 01:32:33 +00:00
29 changed files with 3375 additions and 794 deletions

BIN
CUni3.pdf

Binary file not shown.

1447
PhDbiblio-url.bst Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
\newpage
{\Huge \bf Abstract}
\vspace{24pt}
Write a summary of the whole thing. Make
sure it fits in one page.
\newpage
\vspace*{\fill}

View File

@ -1,32 +0,0 @@
\newpage
{\Huge \bf Declaration}
\vspace{24pt}
I, \authorname of \authorcollege, being a candidate for Computer
Science Tripos, Part III, hereby declare that this report and the
work described in it are my own work, unaided except as may be
specified below, and that the report does not contain material that
has already been used to any substantial extent for a comparable
purpose.
\vspace{24pt}
Total word count: \wordcount
\vspace{60pt}
\textbf{Signed}:
\vspace{12pt}
\textbf{Date}: \today
\vfill
This dissertation is copyright \copyright 2022 \authorname.
\\
All trademarks used in this dissertation are hereby acknowledged.
\newpage
\vspace*{\fill}

View File

@ -0,0 +1,93 @@
\documentclass[12pt,crop,tikz]{standalone}
\providecommand{\rootdir}{..}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\tikzstyle{arrow} = [thick,->,>=stealth]
% The Tableau20 colours
\definecolor{TabLightOrange}{RGB}{255,187,120}
\definecolor{TabOrange}{RGB}{255,127,14}
\definecolor{TabLightBlue}{RGB}{174,199,232}
\definecolor{TabBlue}{RGB}{31,119,180}
\definecolor{TabGreen}{RGB}{44,160,44}
\definecolor{TabLightGreen}{RGB}{152,223,138}
\definecolor{TabSalmon}{RGB}{255,152,150}
\definecolor{TabRed}{RGB}{214,39,40}
\definecolor{TabPurple}{RGB}{148,103,189}
\definecolor{TabLightPurple}{RGB}{197,176,213}
\definecolor{TabLightPink}{RGB}{247,182,210}
\definecolor{TabPink}{RGB}{227,119,194}
\definecolor{TabLightBrown}{RGB}{196,156,148}
\definecolor{TabBrown}{RGB}{140,86,75}
\definecolor{TabGray}{RGB}{127,127,127}
\definecolor{TabOlive}{RGB}{188,189,34}
\definecolor{TabLightOlive}{RGB}{219,219,141}
\definecolor{TabLightGray}{RGB}{199,199,199}
\definecolor{TabLightCyan}{RGB}{158,218,229}
\definecolor{TabCyan}{RGB}{23,190,207}
\begin{document}
\def\titlepad{0.1}
\def\boxspacing{40mm}
\def\layer{0.3}
\def\inner{0.3}
\def\innerspace{0.2}
\def\layerwidth{5cm}
\def\halflayerwidth{2.35cm}
\def\layerheight{0.8cm}
\def\innerwidth{4.4cm}
\def\halfinnerwidth{2.1cm}
\begin{tikzpicture}[ every node/.style={font=\small}
, layer/.style= {rectangle, draw=black!50, thick, minimum width=\layerwidth , minimum height=\layerheight}
, halflayer/.style={rectangle, draw=black!50, thick, minimum width=\halflayerwidth, minimum height=\layerheight}
, inner/.style= {rectangle, draw=black!50, thick, minimum width=\innerwidth , minimum height=\layerheight}
, halfinner/.style={rectangle, draw=black!50, thick, minimum width=\halfinnerwidth, minimum height=\layerheight}
, red/.style={fill=TabPurple!40}
, orange/.style={fill=TabBlue!40}
, yellow/.style={fill=TabCyan!40}
, green/.style={fill=TabLightGreen!60}
, node distance = 0cm
, arrow={->,>=stealth}
]
\begin{scope}[local bounding box=graph-body]
\node[layer,orange] (void-processes) {Void Processes (§\ref{sec:system-design})};
\node[circle,fill,inner sep=1.5pt, yellow, below = \innerspace of void-processes] (void-processes-dot) {};
\node[circle,fill,inner sep=1.5pt, yellow, above left=3*\layerheight and 3*\layerheight of void-processes-dot] (unikernels-dot) {};
\node[layer, above = \innerspace of unikernels-dot] (unikernels) {Unikernels};
\node[circle,fill,inner sep=1.5pt, yellow, below right=3*\layerheight and 2*\layerheight of void-processes-dot] (containers-dot) {};
\node[layer, above = \innerspace of containers-dot] (containers) {Containers (§\ref{sec:priv-sep-perspective})};
\node[circle,fill,inner sep=1.5pt, yellow, below left=5*\layerheight and 1*\layerheight of void-processes-dot] (virtual-machines-dot) {};
\node[layer, above = \innerspace of virtual-machines-dot] (virtual-machines) {Virtual Machines (§\ref{sec:priv-sep-another-machine})};
\node[circle,fill,inner sep=1.5pt, yellow, below right=5*\layerheight and 11*\layerheight of void-processes-dot] (ambient-authority-dot) {};
\node[layer, above left=\innerspace and \innerspace of ambient-authority-dot] (ambient-authority) {Ambient Authority};
\end{scope}
\coordinate (graph-body-nw) at ($ (graph-body.north west) + (-0.3, 0.3 + \titlepad) $);
\coordinate (graph-body-ne) at ($ (graph-body.north east) + ( 0.3, 0.3 + \titlepad) $);
\coordinate (graph-body-sw) at ($ (graph-body.south west) + (-0.3,-0.3) $);
\coordinate (graph-body-se) at ($ (graph-body.south east) + ( 0.3,-0.3) $);
% Axes
\draw[->] ($ (graph-body-nw) + (0.15, 0) $) -- (graph-body-ne);
\draw[->] (graph-body-nw) -- (graph-body-sw);
% Axis labels
\node[rectangle,fill=white] at ($ (graph-body-nw)!0.5!(graph-body-ne) $) (x-axis-label) {Attack surface};
\node[rectangle,fill=white,rotate around={90:($ (graph-body-nw)!0.5!(graph-body-sw) $)}] at ($ (graph-body-nw)!0.5!(graph-body-sw) $) (y-axis-label) {Linux compatibility};
\end{tikzpicture}
\end{document}

View File

@ -0,0 +1,176 @@
\documentclass[12pt,crop,tikz]{standalone}
\providecommand{\rootdir}{..}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\tikzstyle{arrow} = [thick,->,>=stealth]
% The Tableau20 colours
\definecolor{TabLightOrange}{RGB}{255,187,120}
\definecolor{TabOrange}{RGB}{255,127,14}
\definecolor{TabLightBlue}{RGB}{174,199,232}
\definecolor{TabBlue}{RGB}{31,119,180}
\definecolor{TabGreen}{RGB}{44,160,44}
\definecolor{TabLightGreen}{RGB}{152,223,138}
\definecolor{TabSalmon}{RGB}{255,152,150}
\definecolor{TabRed}{RGB}{214,39,40}
\definecolor{TabPurple}{RGB}{148,103,189}
\definecolor{TabLightPurple}{RGB}{197,176,213}
\definecolor{TabLightPink}{RGB}{247,182,210}
\definecolor{TabPink}{RGB}{227,119,194}
\definecolor{TabLightBrown}{RGB}{196,156,148}
\definecolor{TabBrown}{RGB}{140,86,75}
\definecolor{TabGray}{RGB}{127,127,127}
\definecolor{TabOlive}{RGB}{188,189,34}
\definecolor{TabLightOlive}{RGB}{219,219,141}
\definecolor{TabLightGray}{RGB}{199,199,199}
\definecolor{TabLightCyan}{RGB}{158,218,229}
\definecolor{TabCyan}{RGB}{23,190,207}
\begin{document}
\def\titlepad{0.1}
\def\boxspacing{40mm}
\def\layer{0.3}
\def\inner{0.3}
\def\innerspace{0.2}
\def\layerwidth{5cm}
\def\halflayerwidth{2.35cm}
\def\layerheight{0.8cm}
\def\innerwidth{4.4cm}
\def\halfinnerwidth{2.1cm}
\begin{tikzpicture}
[ every node/.style={font=\small}
, layer/.style= {rectangle, draw=black!50, thick, minimum width=\layerwidth , minimum height=\layerheight}
, halflayer/.style={rectangle, draw=black!50, thick, minimum width=\halflayerwidth, minimum height=\layerheight}
, inner/.style= {rectangle, draw=black!50, thick, minimum width=\innerwidth , minimum height=\layerheight}
, halfinner/.style={rectangle, draw=black!50, thick, minimum width=\halfinnerwidth, minimum height=\layerheight}
, red/.style={fill=TabPurple!40}
, orange/.style={fill=TabBlue!40}
, yellow/.style={fill=TabCyan!40}
, green/.style={fill=TabLightGreen!60}
, node distance = 0cm
, arrow={->,>=stealth}
]
%-----------------------------------------------------------------------------
% conventional syslogd
%-----------------------------------------------------------------------------
\begin{scope}[local bounding box=syslogd]
\node[layer] (syslogd-root) {Root privilege};
% hack to get the spacing right
\coordinate (std-spaced_app1) at ($ (syslogd-root.south)+(0,-\inner) $);
\node[layer, orange, below = 2mm of syslogd-root] (syslogd-app) {syslogd.c};
\node[layer, fill=white, below = 2*\layer of syslogd-app] (syslogd-untrusted) {Untrusted user data};
% Lines down the left
\coordinate (std-lline) at ($ (syslogd-app) + (-1.15,0) $);
\draw[->] (std-lline |- 0, 0 |- syslogd-root.south) -- (std-lline |- 0, 0 |- syslogd-app.north);
% Lines down the right
\coordinate (std-rline) at ($ (syslogd-app) + (1.15,0) $);
\draw[->] (std-rline |- 0, 0 |- syslogd-app.north) -- (std-rline |- 0, 0 |- syslogd-root.south);
\end{scope}
\begin{scope}[local bounding box=syslogd-kernel]
\fill[gray!15] ($ (syslogd-untrusted.north west) + (-\layer,\layer) $) rectangle ($ (syslogd-untrusted.south east) + (\layer, -\layer) $);
\end{scope}
\draw[-, gray, dashed] (syslogd-kernel.north west) -- (syslogd-kernel.north east);
\node[layer, fill=white, below = 2*\layer of syslogd-app] (syslogd-untrusted) {Untrusted user data};
\draw[->] (std-lline |- 0, 0 |- syslogd-app.south) -- (std-lline |- 0, 0 |- syslogd-untrusted.north);
\draw[<-] (std-rline |- 0, 0 |- syslogd-app.south) -- (std-rline |- 0, 0 |- syslogd-untrusted.north);
\coordinate (syslogd-nw) at ($ (syslogd.north west) + (-\inner, \inner + \titlepad) $);
\coordinate (syslogd-ne) at ($ (syslogd.north east) + ( \inner, \inner + \titlepad) $);
\coordinate (syslogd-sw) at ($ (syslogd.south west) + (-\inner,-\inner) $);
\coordinate (syslogd-se) at ($ (syslogd.south east) + ( \inner,-\inner) $);
\draw[draw, thick] (syslogd-nw) rectangle (syslogd-se);
\node[rectangle, fill=white] at ($(syslogd-nw)!0.5!(syslogd-ne)$) (syslogd_label) {\normalsize\textbf{Conventional syslogd}};
%-----------------------------------------------------------------------------
% privsep syslogd
% -----------------------------------------------------------------------------
\begin{scope}[local bounding box=client]
% \coordinate[right=5cm of syslogd-] (client_center)
\node[layer, below = 3cm of syslogd] (privsep-syslogd-root) {Root privilege};
% hack to get the spacing right
\coordinate (spaced_app1) at ($ (privsep-syslogd-root.south)+(0,-\inner) $);
\begin{scope}[local bounding box=privsep-syslogd-app]
\node[inner, red, below = \layer of spaced_app1, yshift=-0.2cm] (rpc1) {privsep.c};
\node[inner, orange, below = 10mm of rpc1] (rpc2) {syslogd.c};
\end{scope}
\coordinate (rpc1-nw) at ($ (privsep-syslogd-app.north west) + (-0.3, 0.3 + \titlepad) $);
\coordinate (rpc1-ne) at ($ (privsep-syslogd-app.north east) + ( 0.3, 0.3 + \titlepad) $);
\coordinate (rpc1-sw) at ($ (privsep-syslogd-app.south west) + (-0.3,-0.3) $);
\coordinate (rpc1-se) at ($ (privsep-syslogd-app.south east) + ( 0.3,-0.3) $);
\draw[draw,thick,dotted] (rpc1-nw) rectangle (rpc1-se);
\coordinate (rpc-bottom) at ($(privsep-syslogd-app.south west)!0.5!(privsep-syslogd-app.south east) + (0, -0.3)$);
\node[layer, fill=white, below = 3*\layer of privsep-syslogd-app] (privsep-syslogd-untrusted) {Untrusted user data};
% Lines down the left
\coordinate (lline) at ($ (privsep-syslogd-app) + (-1.15,0) $);
\draw[->] (lline |- 0, 0 |- privsep-syslogd-root.south) -- (lline |- 0, 0 |- rpc1.north);
\draw[->] (lline |- 0, 0 |- rpc1.south) -- node[left, text width = 1cm, align = center]
{\normalsize\emph{open files}} (lline |- 0, 0 |- rpc2.north);
% Lines down the right
\coordinate (rline) at ($ (privsep-syslogd-app) + (1.15,0) $);
\draw[->] (rline |- 0, 0 |- rpc1.north) -- (rline |- 0, 0 |- privsep-syslogd-root.south);
%\draw[->] (rline |- 0, 0 |- rpc2.north) -- (rline |- 0, 0 |- rpc1.south);
\draw[->] (rline |- 0, 0 |- rpc2.north) -- node[right, text width = 1cm, align = center]
{\normalsize\emph{RPCs}} (rline |- 0, 0 |- rpc1.south);
\end{scope}
\begin{scope}[on background layer, local bounding box=client-kernel]
\fill[gray!15] ($ (privsep-syslogd-untrusted.north west) + (-\layer,\layer) $) rectangle ($ (privsep-syslogd-untrusted.south east) + (\layer, -\layer) $);
\end{scope}
\draw[-, gray, dashed] (client-kernel.north west) -- (client-kernel.north east);
\coordinate (client-nw) at ($ (client.north west) + (-\inner, \inner + \titlepad) $);
\coordinate (client-ne) at ($ (client.north east) + ( \inner, \inner + \titlepad) $);
\coordinate (client-sw) at ($ (client.south west) + (-\inner,-\inner) $);
\coordinate (client-se) at ($ (client.south east) + ( \inner,-\inner) $);
\draw[draw, thick] (client-nw) rectangle (client-se);
\node[rectangle, fill=white] at ($(client-nw)!0.5!(client-ne)$) (client_label) {\normalsize\textbf{privsep syslogd}};
\draw[->] (lline |- 0, 0 |- privsep-syslogd-app.south) -- (lline |- 0, 0 |- privsep-syslogd-untrusted.north);
\draw[<-] (rline |- 0, 0 |- privsep-syslogd-app.south) -- (rline |- 0, 0 |- privsep-syslogd-untrusted.north);
\coordinate (yheight) at ($ (syslogd-root.east) + (0, -1) $);
\coordinate (trans-arrow-l) at (syslogd-kernel.east |- 0, 0 |- yheight);
\coordinate (trans-arrow-r) at (client-kernel.west |- 0, 0 |- yheight);
%\draw[very thick, ->] ($(trans-arrow-l) + (0.5, 0)$) -- node[above, text width = 4cm, align = center, yshift=3mm]
%\draw[very thick, ->] (syslogd-kernel) -- ($ (client.north) + (0, 2*\inner) $)
\draw[very thick, ->] (syslogd-kernel.south) -- node[right, text width = 3.9cm, align = center, yshift=0.5mm]
{\normalsize\emph{Pass file descriptors \\[1mm] rather than \\[1mm] ambient privilege}} ($ (client.north) + (0, 2*\inner) $);
\end{tikzpicture}
\end{document}

View File

@ -0,0 +1,127 @@
\documentclass[12pt,crop,tikz]{standalone}
\providecommand{\rootdir}{..}
\usepackage{tikz}
\usetikzlibrary{backgrounds}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
\usetikzlibrary{decorations.pathreplacing}
\tikzstyle{arrow} = [thick,->,>=stealth]
% The Tableau20 colours
\definecolor{TabLightOrange}{RGB}{255,187,120}
\definecolor{TabOrange}{RGB}{255,127,14}
\definecolor{TabLightBlue}{RGB}{174,199,232}
\definecolor{TabBlue}{RGB}{31,119,180}
\definecolor{TabGreen}{RGB}{44,160,44}
\definecolor{TabLightGreen}{RGB}{152,223,138}
\definecolor{TabSalmon}{RGB}{255,152,150}
\definecolor{TabRed}{RGB}{214,39,40}
\definecolor{TabPurple}{RGB}{148,103,189}
\definecolor{TabLightPurple}{RGB}{197,176,213}
\definecolor{TabLightPink}{RGB}{247,182,210}
\definecolor{TabPink}{RGB}{227,119,194}
\definecolor{TabLightBrown}{RGB}{196,156,148}
\definecolor{TabBrown}{RGB}{140,86,75}
\definecolor{TabGray}{RGB}{127,127,127}
\definecolor{TabOlive}{RGB}{188,189,34}
\definecolor{TabLightOlive}{RGB}{219,219,141}
\definecolor{TabLightGray}{RGB}{199,199,199}
\definecolor{TabLightCyan}{RGB}{158,218,229}
\definecolor{TabCyan}{RGB}{23,190,207}
\begin{document}
\def\titlepad{0.1}
\def\boxspacing{40mm}
\def\layer{0.3}
\def\inner{0.3}
\def\innerspace{0.2}
\def\layerwidth{15cm}
\def\halflayerwidth{2.35cm}
\def\thirdlayerwidth{4.85cm}
\def\layerheight{0.8cm}
\def\innerwidth{4.4cm}
\def\halfinnerwidth{2.1cm}
\begin{tikzpicture}
[ every node/.style={font=\small}
, layer/.style= {rectangle, draw=black!50, thick, minimum width=\layerwidth , minimum height=\layerheight}
, halflayer/.style={rectangle, draw=black!50, thick, minimum width=\halflayerwidth, minimum height=\layerheight}
, inner/.style= {rectangle, draw=black!50, thick, minimum width=\innerwidth , minimum height=\layerheight}
, halfinner/.style={rectangle, draw=black!50, thick, minimum width=\halfinnerwidth, minimum height=\layerheight}
, dashed/.style= {rectangle, draw=black!25, dotted, thick, minimum width=\innerwidth, minimum height=\layerheight}
, red/.style={fill=TabPurple!40}
, orange/.style={fill=TabBlue!40}
, yellow/.style={fill=TabCyan!40}
, green/.style={fill=TabLightGreen!60}
, node distance = 0cm
, arrow={->,>=stealth}
]
\begin{scope}[local bounding box=std-client]
\node[layer] (ambient-authority) {Ambient Authority};
\node[layer, orange, below = 2mm of ambient-authority] (void-orchestrator) {Void Orchestrator};
\draw[->] (ambient-authority.south) -- (void-orchestrator.north);
% hack to get the spacing right
\coordinate (std-spaced_app1) at ($ (void-orchestrator.south)+(0,-\inner) $);
\begin{scope}[local bounding box=spawners]
\node[inner, red, below = \layer of std-spaced_app1, yshift=-0.2cm] (tls-handler-spawner) {TLS Handler Spawner};
\node[dashed, left = 5.5mm of tls-handler-spawner] (connection-listener-spawner) {};
\node[inner, red, right = 5.5mm of tls-handler-spawner] (http-handler-spawner) {HTTP Handler Spawner};
\end{scope}
\node[inner, green, below = 3*\layer of connection-listener-spawner] (connection-listener) {Connection Listener};
\node[inner, green, below = 3*\layer of tls-handler-spawner] (tls-handler) {TLS Handler};
\node[inner, green, below = 3*\layer of http-handler-spawner] (http-handler) {HTTP Handler};
\coordinate (spawners-nw) at ($ (spawners.north west) + (-0.3, 0.3 + \titlepad) $);
\coordinate (spawners-ne) at ($ (spawners.north east) + ( 0.3, 0.3 + \titlepad) $);
\coordinate (spawners-sw) at ($ (spawners.south west) + (-0.3,-0.3) $);
\coordinate (spawners-se) at ($ (spawners.south east) + ( 0.3,-0.3) $);
\draw[draw,thick,dotted] (spawners-nw) rectangle (spawners-se);
\node[rectangle,fill=white] at ($(spawners-nw)!0.5!(spawners-ne)$) (spawners_label) {\textit{Spawners}};
% Left line locations (to avoid spawner header)
\coordinate (left-lline) at ($ (connection-listener-spawner) + (-1.15,0) $);
\coordinate (mid-lline) at ($ (tls-handler-spawner) + (-1.15,0) $);
\coordinate (right-lline) at ($ (http-handler-spawner) + (-1.15,0) $);
\coordinate (left-rline) at ($ (connection-listener-spawner) + (1.15,0) $);
\coordinate (mid-rline) at ($ (tls-handler-spawner) + (1.15,0) $);
% Lines for the left set
\draw[->] (left-lline |- 0, 0 |- void-orchestrator.south) -- (left-lline |- 0, 0 |- connection-listener.north);
% Lines for the center set
\draw[->] (mid-lline |- 0, 0 |- void-orchestrator.south) -- (mid-lline |- 0, 0 |- tls-handler-spawner.north);
\draw[->] (mid-lline |- 0, 0 |- tls-handler-spawner.south) -- (mid-lline |- 0, 0 |- tls-handler.north);
% Lines for the right set
\draw[->] (right-lline |- 0, 0 |- void-orchestrator.south) -- (right-lline |- 0, 0 |- http-handler-spawner.north);
\draw[->] (right-lline |- 0, 0 |- http-handler-spawner.south) -- (right-lline |- 0, 0 |- http-handler.north);
% Special lines
\draw[->] (connection-listener.east) -- ($(connection-listener.east)!0.5!(tls-handler.west)$) -- ($(connection-listener-spawner.east)!0.5!(tls-handler-spawner.west)$) -- (tls-handler-spawner.west);
\draw[->] (tls-handler.east) -- ($(tls-handler.east)!0.5!(http-handler.west)$) -- ($(tls-handler-spawner.east)!0.5!(http-handler-spawner.west)$) -- (http-handler-spawner.west);
\end{scope}
\coordinate (std-client-nw) at ($ (std-client.north west) + (-\inner, \inner + \titlepad) $);
\coordinate (std-client-ne) at ($ (std-client.north east) + ( \inner, \inner + \titlepad) $);
\coordinate (std-client-sw) at ($ (std-client.south west) + (-\inner,-\inner) $);
\coordinate (std-client-se) at ($ (std-client.south east) + ( \inner,-\inner) $);
\draw[draw, thick] (std-client-nw) rectangle (std-client-se);
\end{tikzpicture}
\end{document}

View File

@ -1,655 +0,0 @@
%%
%% ACS project dissertation template.
%%
%% Currently designed for printing two-sided, but if you prefer to
%% print single-sided just remove ",twoside,openright" from the
%% \documentclass[] line below.
%%
%%
%% SMH, May 2010.
\documentclass[a4paper,12pt,twoside,openright]{report}
%%
%% EDIT THE BELOW TO CUSTOMIZE
%%
\def\authorname{Jake Hillion\xspace}
\def\authorcollege{Queens' College\xspace}
\def\authoremail{Jake.Hillion@cl.cam.ac.uk}
\def\dissertationtitle{Void Processes: minimising privilege by default}
\def\wordcount{5}
\usepackage{courier}
\usepackage{dirtytalk} %quotations
\usepackage{epsfig}
\usepackage{graphicx}
\usepackage{listings}
\usepackage{multirow}
\usepackage{natbib}
\usepackage{parskip}
\usepackage{setspace}
\usepackage{tabularx}
\usepackage{verbatim}
\usepackage{xspace}
% TODO: remove me
\usepackage{todonotes}
\setuptodonotes{inline}
\setcounter{tocdepth}{1} % stop toc at sections
%% START OF DOCUMENT
\begin{document}
%TC:ignore
%% FRONTMATTER (TITLE PAGE, DECLARATION, ABSTRACT, ETC)
\pagestyle{empty}
\singlespacing
\input{titlepage}
\onehalfspacing
\input{declaration}
\singlespacing
\input{abstract}
\pagenumbering{roman}
\setcounter{page}{0}
\pagestyle{plain}
\tableofcontents
%\listoffigures
%\listoftables
\onehalfspacing
\setstretch{1.2}
%TC:endignore
%% START OF MAIN TEXT
\chapter{Introduction}
\label{chap:introduction}
\pagenumbering{arabic}
\setcounter{page}{1}
Void Processes allow running purpose-built applications without all of the features that a full Linux system makes available, and encourage privilege separation by default. This is achieved using a mixture of Linux namespaces and file descriptor based capabilities. During the process of building the system gaps in the kernel were exposed - namespaces were intended to emulate an ordinary Linux system rather than build something new. This work will go on to detail the mechanisms for creating Void Processes themselves, re-adding features that these processes need to do useful work, and describe which features are missing in the user-space kernel APIs to successfully create processes this way.
The question of what makes an operating system has been asked many times. There have previously been many attempts to redefine an operating system. Here we compare this work with two of those: unikernels and containers. Unikernels abandon the monolithic kernel in favour of a slimmed down kernel that only provides the features the user needs, limiting the trusted computing base but requiring special purpose applications to be written. Containers provide a view of an isolated system while sharing a monolithic kernel with the host, allowing almost any application that can run on Linux to run in a Linux Container, but including all of the features and security holes that come with running a monolithic kernel. Void Processes lie between the two. While they still rely on the monolithic kernel for isolation and inter-process communication, further reliance on the kernel is limited as much as possible. While much of the Linux experience is made unavailable the core calls remain the same, such as operations on file descriptors. By having nothing available at all by default, an environment where every privilege required must be explicitly added is created. When combined with inter-process communication, a feature not as ingrained in unikernels, high levels of privilege separation are achieved. These methods are plotted in Figure \ref{fig:least-to-most-linux}.
\begin{figure}[h]
\centering
\includegraphics[width=0.6\textwidth]{figures/least-most-linux.png}
\caption{Privilege separated environments plotted from least to most like bare metal Linux.}
\label{fig:least-to-most-linux}
\end{figure}
\begin{table}
\caption{Table showing the date and kernel version each namespace was added. The date provides the date of the first commit where they appeared, and the kernel version the kernel release they appear in the changelog of. Namespaces are ordered by kernel version then alphabetically. Some examples are provided of CVEs of each namespace, and CVEs that each namespace protects against.}
\begin{center}
\begin{tabular}{l|lr|lr|l|l}
ns & \multicolumn{2}{l}{date} & \multicolumn{2}{|l|}{kernel ver.} & ns CVEs & prot. CVEs \\ \hline
\texttt{mount}
& Feb 2001 & \citep{viro_patchcft_2001}
& 2.5.2 & \citep{torvalds_linux_2002}
& 2020-29373
& test \newline test2 \\
\texttt{ipc}
& Oct 2006 & \citep{korotaev_patch_2006}
& 2.6.19 & \citep{noauthor_linux_2006}
&
& \\
\texttt{uts}
& Oct 2006 & \citep{hallyn_patch_2006}
& 2.6.19 & \citep{noauthor_linux_2006}
&
& \\
\texttt{user}
& Jul 2007 & \citep{le_goater_user_2007}
& 2.6.23 & \citep{noauthor_linux_2007}
& 2021-21284
& \\
\texttt{network}
& Oct 2007 & \citep{biederman_net_2007}
& 2.6.24 & \citep{noauthor_linux_2008}
& 2011-2189
& \\
\texttt{pid}
& Oct 2006 & \citep{bhattiprolu_patch_2006}
& 2.6.24 & \citep{noauthor_linux_2008}
& 2019-20794
& \\
\texttt{cgroup}
& Mar 2016 & \citep{heo_git_2016}
& 4.6 & \citep{torvalds_linux_2016}
& 2022-0492
& \\
\texttt{time}
& Nov 2019 & \citep{vagin_ns_2020}
& 5.6 & \citep{noauthor_linux_2020}
&
&
\end{tabular}
\end{center}
\label{tab:namespaces}
\end{table}
\chapter{Privilege Separation}
\label{chap:priv-sep}
Many attack vectors exist in software, notably in argument processing and deserialisation \citep{the_mitre_corporation_improper_2006,the_mitre_corporation_deserialization_2006}. Creating security conscious applications requires one of two things: creating applications without security bugs, or separating the parts of the application with the potential to cause damage from the parts most likely to contain bugs. Though many efforts have been made to create correct applications [CN], the use of such technology is far from widespread and security related bugs in applications are still frequent [CN]. Rather than attempting to avoid bugs, the commonly employed solution is privilege separation: ensuring that the privileged portion of the application is separated from the portion which is likely to be attacked, and that the interface between them is correct. This chapter details what privilege separation is, why it is useful, and a summary of some of the privilege separation techniques available in modern Unices. Many of these techniques are included in some form in the final design for Void Processes.
\section{Privilege separation by process}
The basic unit of privilege separation on Unix is a process. If it's possible for an attacker to gain remote code execution in a process, the attacker gains access to all of that process's privilege. Reducing the privilege of a process therefore reduces the benefit of attacking that process. One solution to reducing privilege in the process is to take a previously monolithic application and split it into multiple smaller processes. Consider a TLS supporting web server that must have access to the certificate's private keys and also process user requests. These elements can be split into different processes. This means that if the user data handling process is compromised the attacker cannot access the contents of the private keys.
Application design in this paradigm is similar to that of a distributed system, where multiple asynchronous systems must interact over various communication channels. As an application becomes more like a networked system, serialisation and deserialisation becomes a common occurrence. As deserialisation is a very common source of exploits \citep{the_mitre_corporation_deserialization_2006}, this adds the potential for new flaws in the application.
OpenBSD is a UNIX operating system with an emphasis on security. A recent bug in OpenBSD's \texttt{sshd} highlights the utility of privilege separation \citep{the_openbsd_foundation_openssh_2022}. An integer overflow in the pre-authentication logic of the SSH daemon allowed a motivated attacker to exploit incorrect logic paths and gain access without authentication. Privilege separation ensures that the process with this bug, the pre-authentication process, is separated from the process which is able to be exploited, the highly privileged daemon. Moreover, privilege separation being mandatory in the software ensures that bugs which are not exploitable due to the privilege separation monitor's checks are not exploitable anywhere.
In 2003, privilege separation was added to the \texttt{syslogd} daemon of OpenBSD \citep{madhavapeddy_privsepc_2003}. The system is designed with a parent process that retains privilege and a network accepting child process that goes through a series of states, dropping privilege with each state change. This pattern allowed for restarting of the service while keeping the section which processed user data strongly separated from the process which remains privileged, by enabling the child process to cause its own restart while not holding enough privilege to execute that restart itself. An overview of the data flow is provided in Figure \ref{fig:openbsd-syslogd-privsep}.
\begin{figure}
\centering
\includegraphics[width=0.4\textwidth]{figures/openbsd-syslogd-privsep.png}
\caption{Data flow with the two processes in OpenBSD's privilege separated syslogd design.}
\label{fig:openbsd-syslogd-privsep}
\end{figure}
\section{Privilege separation by time}
Many applications can privilege separate by using a single process which reduces its level of privilege as the application makes progress. This is effectively privilege separation over time. The approach is commonly to begin with high privilege for opening, for example, a listening socket below port 1000. After this has been completed, the ability to do so is dropped. One of the simplest ways to do this is to change user using \texttt{setuid(2)} after the privileged requirements are complete. An API such as OpenBSD's \texttt{pledge(2)} allows only a pre-specified set of system calls after the call to \texttt{pledge(2)}. A final alternative is to drop explicit capabilities on Linux. Each of these solutions irreversibly reduce the privilege of the process. This is known as dropping privilege. As the privilege has been irreversibly dropped, any attacker who gains control after the privilege has been dropped cannot take advantage of it.
After dropping privilege, it becomes difficult to do things such as reloading the configuration. The application process no longer has the required privilege to restart the application, and if it could gain it back then dropping it would have had no effect. This avoids having to treat the application as a distributed system as there continues to be only a single process to manage, which is often an easier paradigm to work in. The difficulty in implementing privilege dropping is ensuring that you know what privilege you hold, and drop it as soon as it is no longer required.
\section{Privilege separation by ownership}
The previous methods shown each suffer from knowing what their initial privilege is. An alternative method to enable the principle of least privilege in applications are object capabilities. An object capability is an unforgeable token of authority to perform some particular set of actions on some particular object.
While the methods looked at until now of privilege separation by process and time are supported by all Unices, object capabilities are a more niche system. Capsicum added object capabilities and was included in FreeBSD 10, released in January 2014 \citep{watson_capsicum_2010}. These capabilities may be shared between processes as with file descriptors. Capability mode removes access to all global namespaces from a process, allowing only operations on capabilities to continue. These capabilities are commonly those opened before the switch to capability mode, but they can also be sent and received (as file descriptors) or converted from a capability with more privilege to a capability with less.
Although capabilities still require some additional work to ensure that only intentional capabilities remain accessible when entering capability mode, they come a lot closer to easy deprivileging than the previous solutions. However, their adoption remains limited at this point. They are unavailable in the latest Linux kernel release (5.17.7) at the time of writing.
\section{Privilege separation by perspective}
Linux approaches increased process separation using namespaces. Namespaces control the view of the world that a process sees. Processes remain the primary method of separation, but utilise namespaces to increase the separation between them. The intended and most common use case of namespaces is providing containers. Containers approximate virtual machines, providing the appearance of running on an isolated system while sharing the same host. Containers, however, have to implement privilege separation in a very different way to the privilege separation we've seen previously. Rather than spawning multiple processes and employing privilege separation techniques to limit the attack vector in each, one spawns multiple containers to form a more literal distributed system. It is common to see, for example, a web server and the database that backs it deployed as two separate containers. These separate containers interact entirely over the network. This means that if a user achieves remote code execution of the database, it does not extend to the web server. This presents an interesting paradigm of small applications which can and often do run on separate physical hosts combining to provide a unified application experience.
\section{Summary}
This work focuses on the application of namespaces to more conventional privilege separation. Working with a shim which orchestrates the process and namespace layout, Void Applications seek to provide a completely pruned minimal Linux experience to each Void Process within the application. This builds on much of the prior work to severely limit the access of processes in the application. There is never a need to drop privileges as processes are created with the absolute minimum privilege necessary to perform correctly. In Chapter \ref{chap:entering-the-void} we discuss each namespace's role in Linux and how to create one which is empty, before explaining in Chapter \ref{chap:filling-the-void} how to reinsert just enough Linux for each process in an application to be able to complete useful work. These combine to form an architecture which minimises privilege by default, motivating highly intentional privilege separation.
\chapter{Entering the Void}
\label{chap:entering-the-void}
Isolating parts of a Linux system from the view of certain processes is achieved by using namespaces. Namespaces are commonly used to provide isolation in the context of containers, which provide the appearance of an isolated complete Linux environment to contained processes. Instead, with Void Processes, we target complete isolation. Rather than using namespaces to provide a view of an alternate full Linux system, they are used to provide a view of a system that is as minimal as possible, while still sitting atop the Linux kernel. In this section each namespace available in Linux is detailed, including how to take a fresh namespace of each kind and completely empty it for a Void Process. Chapter \ref{chap:filling-the-void} goes on to explain how necessary features for applications are added back in.
The full set of namespaces are represented in Table \ref{tab:namespaces}, in chronological order. The chronology of these is important in understanding the thought process behind some of the design decisions. The ease of creating an empty namespace varies massively, as although adding namespaces shared the goal of containerisation, they were completed by many different teams of people over a number of years. Some namespaces maintain strong connections to their parent, while others are created with absolute separation. We start with those that are most trivial to add, working up to the namespaces most intensely linked to their parents.
\section{ipc namespaces}
\label{sec:voiding-ipc}
IPC namespaces isolate two mechanisms that Linux provides for IPC which aren't controlled by the filesystem. System V IPC and POSIX message queues are each accessed in a global namespace of keys. This has created issues in the past with attempting to run multiple instances of PostgreSQL on a single machine, as both instances tried to create a System V IPC entry with the same key [CN]. IPC namespaces solve this effectively for containers by creating a new scoped namespace. Processes are a member of one and only one IPC namespace, allowing the familiar global key APIs. IPC namespaces are optimal for creating Void Processes. From the manual page \citep{free_software_foundation_ipc_namespaces7_2021}:
\say{Objects created in an IPC namespace are visible to all other processes that are members of that namespace, but are not visible to processes in other IPC namespaces.}
This provides exactly the correct semantics for a Void Process. IPC objects are visible within a namespace if and only if they are created within that namespace. Therefore, a new namespace is entirely empty, and no more work need be done.
\section{uts namespaces}
\label{sec:voiding-uts}
UTS namespaces provide isolation of the hostname and domain name of a system between processes. Similarly to IPC namespaces, all processes in the same namespace see the same results for each of these values. This is useful when creating containers. If unable to hide the hostname, each container would look like the same machine. Unlike IPC namespaces, UTS namespaces are copy-on-write. Each of these values in the child is initialised as the same as the parent.
As the copied value does give information about the world outside of the Void Process, slightly more must be done than placing the process in a new namespace. Fortunately this is easy for UTS namespaces, as the host name and domain name can be set to constants, removing any link to the parent.
\section{time namespaces}
\label{sec:voiding-time}
Time namespaces are the final namespace added at the time of writing, added in kernel version 5.6 \citep{noauthor_linux_2020}. The motivation for adding time namespaces is given in the manual page \citep{free_software_foundation_time_namespaces7_2021}:
\say{The motivation for adding time namespaces was to allow the monotonic and boot-time clocks to maintain consistent values during container migration and checkpoint/restore.}
That is, time namespaces virtualise the appearance of system uptime to processes, rather than attempting to virtualise the wall clock time. This is important for processes that depend on time in primarily one situation: migration. If an uptime dependent process is migrated from a machine that has been up for a week to a machine that was booted a minute ago, the guarantees provided by the clocks \texttt{CLOCK\_MONOTONIC} and \texttt{CLOCK\_BOOTTIME} no longer hold. This results in time namespaces having very limited usefulness in a system that does not support migration, such as the one presented here. Perhaps randomised offsets would hide some information about the system, but the usefulness is limited. Time namespaces are thus avoided in this implementation.
\section{network namespaces}
\label{sec:voiding-net}
Similarly to IPC, they present the optimal namespace for running a Void Process. Creating a new network namespace immediately creates a namespace containing only a local loopback adapter. This means that the new network namespace has no link whatsoever to the creating network namespace, only supporting internal communication. To add a link, one can create a virtual Ethernet pair with one adapter in each namespace (see Figure \ref{fig:virtual-ethernet}). Alternatively, one can create a Wireguard adapter with sending and receiving sockets in one namespace and the VPN adapter in another \citep[§7.3]{donenfeld_wireguard_2017}. These methods allow for very high levels of separation while still maintaining access to the primary resource - the Internet or wider network.
\begin{figure}
\begin{minipage}{.45\textwidth}
\lstset{caption={}}
\begin{lstlisting}[frame=tlrb,showlines=true]{Name}
#
#
# ip link add veth0 type veth peer veth1
# ip link set veth1 netns test
# ip addr add 192.168.0.1/24 dev veth0
# ip link set up dev veth0
# ping -c 1 192.168.0.2
PING 192.168.0.2 (192.168.0.2) 56(84) bytes of data.
64 bytes from 192.168.0.2: icmp_seq=1 ttl=64 time=0.317 ms
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
\lstset{caption={}}
\begin{lstlisting}[frame=tlrb]{Name}
# unshare -n
# ip netns attach test $$
#
#
# ip addr add 192.168.0.2/24 dev veth1
# ip link set up dev veth1
# ping -c 1 192.168.0.1
PING 192.168.0.1 (192.168.0.1) 56(84) bytes of data.
64 bytes from 192.168.0.1: icmp_seq=1 ttl=64 time=0.107 ms
\end{lstlisting}
\end{minipage}
\caption{Creating a virtual Ethernet pair between the root network namespace and a newly created network namespace.}
\label{fig:virtual-ethernet}
\end{figure}
\section{pid namespaces}
\label{sec:voiding-pid}
PID namespaces create a mapping from the process IDs inside the namespace to process IDs in the parent namespace. This continues until processes reach the top-level PID namespace. This isolation behaviour is different to that of some other namespaces, as each process within the namespace represents a process in the parent namespace too, albeit with different identifiers.
Although PID namespaces work quite well for creating a Void Process from the perspective of the inside process, some care must be taken in the implementation, as the actions of PID namespaces are highly affected by others. Some examples of this slightly unusual behaviour are shown in Listing \ref{lst:unshare-pid}.
The first behaviour shown is that an \texttt{unshare(CLONE\_PID)} call followed immediately by an \texttt{exec} does not have the desired behaviour. The reason for this is that the first process created in the new namespace is given PID 1 and acts as an init process. That is, whichever process the shell spawns first becomes the init process of the namespace, and when that process dies, the namespace can no longer create new processes. This behaviour is avoided by either calling \texttt{unshare(2)} followed by \texttt{fork(2)}, or utilising \texttt{clone(2)} instead. The \texttt{unshare(1)} binary provides a fork flag to solve this, while the implementation of the Void Orchestrator uses \texttt{clone(2)} which has the semantics of combining the two into a single syscall.
Secondly, we see that even in a shell that appears to be working correctly, processes from outside of the new PID namespace are still visible. This behaviour occurs because the mount of \texttt{/proc} visible to the process in the new PID namespace is the same as the init process. This is solved by remounting \texttt{/proc}, available to \texttt{unshare(3)} with the \texttt{---mount-proc} flag. Care must be taken that this mount is completed in a new mount namespace, or else processes outside of the PID namespace will be affected. The Void Orchestrator again avoids this by voiding the mount namespace entirely, so any access to proc must be either bound to outside the namespace deliberately or freshly mounted.
\lstset{caption={Unshare behaviour with PID namespaces, with and without forking and remounting proc.}}
\begin{lstlisting}[float,label={lst:unshare-pid}]
$ unshare -p
-bash: fork: Cannot allocate memory
# (new shell in new pid namespace)
# ps ax | tail -n 3
-bash: fork: Cannot allocate memory
$ unshare --fork -p
# (new shell in new pid namespace)
# ps ax | tail -n 3
2645 ? I 0:00 [kworker/...]
2689 pts/1 R+ 0:00 ps ax
2690 pts/1 S+ 0:00 tail -n 2
$ unshare --fork --mount-proc -p
# (new shell in new pid namespace)
# ps ax | tail -n 3
1 pts/1 S 0:00 -bash
15 pts/1 R+ 0:00 ps ax
16 pts/1 S+ 0:00 tail -n 3
\end{lstlisting}
\section{mount namespaces}
\label{sec:voiding-mount}
Mount namespaces were by far the most challenging part of this project. When adding new features, they continuously raised problems in both API description, expected behaviour, and availability of tools in user-space. A comparison will be given in this section to two other namespaces, network and UTS, to show the significant differences in the design goals of mount namespaces. Many of the implementation problems here comes from a fundamental lack of consistency between mount namespaces and other namespaces in Linux.
\subsection{Copy-on-Write}
Comparing to network namespaces, we see a huge difference in what occurs when a new namespace is created. When creating a new network namespace, the ideal conditions for a Void Process are created - a network namespace containing only a loopback adapter. That is, the process has no ability to interact with the outside network, and no immediate relation to the parent network namespace. To interact with alternate namespaces, one must explicitly create a connection between the two, or move a physical adapter into the new (empty) namespace. Mount namespaces, rather than creating a new and empty namespace, made the choice to create a copy of the parent namespace, in a copy-on-write fashion. That is, after creating a new mount namespace, the mount hierarchy appears much the same as before. This is shown in Listing \ref{lst:unshare-cat-passwd}, where the file \texttt{/etc/passwd} is shown before and after an unshare, revealing the same content.
\lstset{caption={Reading the same file before and after unsharing the mount namespace.}}
\begin{lstlisting}[float,label={lst:unshare-cat-passwd}]
int main() {
int fd;
if ((fd = open("/etc/passwd", O_RDONLY)) < 0)
perror("open");
print_file(fd);
if (close(fd))
perror("close");
if (unshare(CLONE_NEWNS))
perror("unshare");
printf("----- unshared -----\n");
if ((fd = open("/etc/passwd", O_RDONLY)) < 0)
perror("open");
print_file(fd);
if (close(fd))
perror("close");
}
--
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
...
----- unshared -----
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
bin:x:2:2:bin:/bin:/usr/sbin/nologin
sys:x:3:3:sys:/dev:/usr/sbin/nologin
...
\end{lstlisting}
\subsection{Shared Subtrees}
While some other namespaces are copy-on-write, for example UTS namespaces, they do not present the same problem as mount namespaces. Although UTS namespaces are copy-on-write, it is trivial to create the conditions for a Void Process by setting the hostname of the machine to a constant. This removes any relation to the parent namespace and to the outside machine. Mount namespaces instead maintain a shared pointer with most filesystems, more akin to not creating a new namespace than a copy-on-write namespace.
Shared subtrees \citep{pai_shared_2005} were introduced to provide a consistent view of the unified hierarchy between namespaces. Consider the example in Figure \ref{fig:shared-subtrees}. \texttt{unshare(1)} creates a non-shared tree, which presents the behaviour shown. Although \texttt{/mnt/cdrom} from the parent namespace has been bind mounted in the new namespace, the content of \texttt{/mnt/cdrom} is not the same. This is because the filesystem newly mounted on \texttt{/mnt/cdrom} is unavailable in the separate mount namespace. To combat this, shared subtrees were introduced. That is, as long as \texttt{/mnt/cdrom} resides on a shared subtree, the newly mounted filesystem will be available to a bind of \texttt{/mnt/cdrom} in another namespace. \texttt{systemd} made the choice to mount \texttt{/} as a shared subtree \citep{free_software_foundation_mount_namespaces7_2021}:
\begin{figure}
\begin{minipage}{.45\textwidth}
\lstset{caption={}}
\begin{lstlisting}[frame=tlrb,showlines=true]{Name}
# unshare -m
# mount_container_root /tmp/a
# mount --bind \
/mnt/cdrom /tmp/a/mnt/cdrom
# pivot_root /tmp/a /tmp/a/oldroot
# umount /tmp/a/oldroot
#
# ls /mnt/cdrom
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
\lstset{caption={}}
\begin{lstlisting}[frame=tlrb]{Name}
#
#
#
#
#
#
# mount /dev/sr0 /mnt/cdrom
# ls /mnt/cdrom
file_1 file_2
\end{lstlisting}
\end{minipage}
\caption{Highly separated behaviour without shared subtrees between mount namespaces.}
\label{fig:shared-subtrees}
\end{figure}
\say{Notwithstanding the fact that the default propagation type for new mount is in many cases \texttt{MS\_PRIVATE}, \texttt{MS\_SHARED} is typically more useful. For this reason, \texttt{systemd(1)} automatically remounts all mounts as \texttt{MS\_SHARED} on system startup. Thus, on most modern systems, the default propagation type is in practice \texttt{MS\_SHARED}.}
This means that when creating a new namespace, mounts and unmounts are propagated by default. More specifically, it means that mounts and unmounts are propagated both from the parent namespace to the child, and from the child namespace to the parent. This can be highly confusing behaviour, as it provides minimal isolation by default. \texttt{unshare(1)} considers this behaviour inconsistent with the goals of unsharing - it immediately calls \texttt{mount("none", "/", NULL, MS\_REC|MS\_PRIVATE, NULL)} after \texttt{unshare(CLONE\_NEWNS)}, detaching the newly unshared tree. The reasoning for enabling \texttt{MS\_SHARED} by default is that containers created should not present the behaviour given in Figure \ref{fig:shared-subtrees}, and this behaviour is unavoidable unless the parent mounts are shared, while it is possible to disable the behaviour where necessary.
\subsection{Lazy unmounting}
Mount namespaces present further interesting behaviour when unmounting the old root filesystem. Although this may initially seem isolated to Void Processes, it is also a problem in a container system. Consider again the container created in Figure \ref{fig:shared-subtrees}: the existing root must be unmounted after pivoting, else the container remains fully connected to the outside root.
Referring again to network namespaces, sockets continue to exist in their initial namespace, allowing for regular file-descriptor passing semantics \citep{biederman_re_2007}. Extending upon this socket behaviour is Wireguard, which creates adapters that may be freely moved between namespaces while continuing to connect externally from their initial parent \citep[§7.3]{donenfeld_wireguard_2017}.
Something which behaves differently is the memory mapping of a currently running process's binary. Consider the example in Listing \ref{lst:unshare-umount}, which shows a short C program and the result of running it. It is seen that the \texttt{/} mount is busy when attempting the unmount. Given that the process was created in the parent namespace, the behaviour of file descriptors would suggest that the process would maintain a link to the parent namespace for its own memory mapped regions. However, the fact that the otherwise empty namespace has a busy mount shows that this is not the case.
\lstset{caption={Behaviour when attempting to unmount / after an unshare.}}
\begin{lstlisting}[float,label={lst:unshare-umount}]
int main() {
if (unshare(CLONE_NEWNS))
perror("unshare");
if (mount("none", "/", NULL,
MS_REC|MS_PRIVATE, NULL))
perror("mount");
if (umount("/"))
perror("umount");
}
--
umount: Device or resource busy
\end{lstlisting}
A feature called lazy unmounting or \texttt{MNT\_DETACH} exists for situations where a busy mount still needs to be unmounted. Supplying the \texttt{MNT\_DETACH} flag to \texttt{umount2(2)} causes the mount to be immediately detached from the unified hierarchy, while remaining mounted internally until the last user has finished with it. Whilst this initially seems like a good solution, this syscall is incredibly dangerous when combined with shared subtrees. This behaviour is shown in Figure \ref{fig:unshare-umount-lazy}, where a lazy (and hence recursive) unmount is combined with a shared subtree to disastrous effect.
\begin{figure}
\begin{minipage}{.45\textwidth}
\lstset{caption={}}
\begin{lstlisting}[frame=tlrb,showlines=true]{Name}
# cat /proc/mounts | grep udev
udev /dev devtmpfs rw,nosuid,relati...
#
#
# cat /proc/mounts | grep udev
cat: /proc/mounts: No such file or...
\end{lstlisting}
\end{minipage}\hfill
\begin{minipage}{.45\textwidth}
\lstset{caption={}}
\begin{lstlisting}[frame=tlrb]{Name}
#
#
# unshare --propagation unchanged -m
# umount -l /
#
#
\end{lstlisting}
\end{minipage}
\caption{Behaviour when attempting to unmount / from an unshared shell with a shared mount.}
\label{fig:unshare-umount-lazy}
\end{figure}
This behaviour raises questions about why a shared subtree, which exists as an object, would need to be detached recursively - decreasing the reference count to the shared subtree itself would seem sufficient. The inconsistency is best explained by looking at the development timeline for the three features here: mount namespaces, shared subtrees, and recursive lazy unmounts. When lazy unmounting was added, in September 2001, the author said the following (sic) \citep{viro_patch_2001}:
\say{There are only two things to take care of -
a) if we detach a parent we should do it for all children
b) we should not mount anything on "floating" vfsmounts.
Both are obviously staisfied for current code (presence of children
means that vfsmount is busy and we can't mount on something that
doesn't exist).}
This logic held even in the presence of namespaces, with the initial patchset in February 2001 \citep{viro_patch_2001}, as mounts were not initially shared but duplicated between namespaces. However, when shared subtrees were added in January 2005 \citep{viro_rfc_2005}, this logic stopped holding.
When setting up a container environment, one calls \texttt{pivot\_root(2)} to replace the old root with a new root for the container. Then, the old root may be unmounted. Oftentimes the solution is to exec a binary in the new root first, meaning that the old root is no longer in use and may be unmounted. This works, as old root is only a reference in this namespace, and hence may be unmounted with children - the \texttt{vfsmount} in this namespace is not busy, contradicting an assertion in the quotation.
If, instead, one wishes to continue running the existing binary, this is possible with lazy unmounting. However, the kernel only exposes a recursive lazy unmount. With shared subtrees, this results in destroying the parent tree. While this is avoidable by removing the shared propagation from the subtree before unmounting, the choice to have \texttt{MNT\_DETACH} aggressively cross shared subtrees can be highly confusing, and perhaps undesired behaviour in a world with shared subtrees by default.
The API is particularly unfriendly to creating a Void Process. The creation of mount namespaces is copy-on-write, and many filesystems are mounted shared. This means that they propagate changes back through namespace boundaries. As the mount namespace does not allow for creating an entirely empty root, extra care must be taken in separating processes. The method taken in this system is mounting a new \texttt{tmpfs} file system in a new namespace, which doesn't propagate to the parent, and using the \texttt{pivot\_root(8)} command to make this the new root. By pivoting to the \texttt{tmpfs}, the old root exists as the only reference in the otherwise empty \texttt{tmpfs}. Finally, after ensuring the old root is set to \texttt{MNT\_PRIVATE} to avoid propagation, the old root can be lazily detached. This allows the binary from the parent namespace, the shim in this case, to continue running correctly. Any new processes only have access to the materials in the empty \texttt{tmpfs}. This new \texttt{tmpfs} never appears in the parent namespace, separating the Void Process effectively from the parent namespace.
\section{user namespaces}
\label{sec:voiding-user}
User namespaces provide isolation of security between processes. They isolate uids, gids, the root directory, keys and capabilities. This provides massive utility for rootless containers [CN], and also this shim. Rather than the shim being a \texttt{setuid} or \texttt{CAP\_SYS\_ADMIN} binary, it can instead operate with ambient authority. This vastly simplifies the logic for opening file descriptors to pass the child processes, as the shim itself is already operating with correctly limited authority.
Similarly to many other namespaces, user namespaces suffer from needing to limit their isolation. For a user namespace to be useful, some relation needs to exist between processes in the user namespace and objects outside. That is, if a process in a user namespace shares a filesystem with a process in the parent namespace, there should be a way to share credentials. To achieve this with user namespaces a mapping between users in the namespace and users outside exists. The most common use-case is to map root in the user namespace to the creating user outside, meaning that a process with full privileges in the namespace will be constrained to the creating user's ambient authority.
To create an effective Void Process content must be written to the files \texttt{/proc/[pid]/uid\_map} and \texttt{/proc/[pid]/gid\_map}. In the case of the shim uid 0 and gid 0 are mapped to the creating user. This is done first such that the remaining stages in creating a Void Process can have root capabilities within the user namespace - this is not possible prior to writing to these files. Otherwise, \texttt{CLONE\_NEWUSER} combines effectively with other namespace flags, ensuring that the user namespace is created first. This enables the other namespaces to be created without additional permissions.
\section{cgroup namespaces}
\label{sec:voiding-cgroup}
cgroup namespaces provide limited isolation of the cgroup hierarchy between processes. Rather than showing the full cgroups hierarchy, they instead show only the part of the hierarchy that the process was in on creation of the new cgroup namespace. Correctly creating a Void Process is hence as follows:
\begin{enumerate}
\item Create an empty cgroup leaf.
\item Move the new process to that leaf.
\item Unshare the cgroup namespace.
\end{enumerate}
This process excludes the cgroup namespace from the initial \texttt{clone(3)} call, as the cloned process must be moved before creating the new namespace. By following this sequence of calls, the process in the void can only see the leaf which contains itself and nothing else, limiting access to the host system. This is the approach taken in this piece of work. This presents the one point where running the shim with ambient authority rather than high capabilities is potentially limiting. In order to move the process into a leaf the shim must have sufficient authority to modify the cgroup hierarchy. On systemd these processes will be launched underneath a user slice and will have sufficient permissions, but this may vary between systems. This leaves cgroups the most weakly implemented namespace at present.
Although good isolation of the host system from the Void Process is provided, the Void Process is in no way hidden from the host. There exists only one cgroups v2 hierarchy on a system (cgroups v1 are ignored for clarity), where resources are delegated through each. This means that all processes contained within the hierarchy must appear in the primary hierarchy, such that the distribution of the single set of system resources can be centrally controlled. This behaviour is similar to the aforementioned pid namespaces, where each process has a distinct PID in each of its parents, but does show up in each. Hiding from the host has little value as a root user there can inspect each namespace manually.
An alternative implementation that would make implementing with the cgroups namespace easier would be one that condenses all of the processes in the sea groups name space into one parent process in the parent main space. This would have the effect of hiding underlying processes from the parent name space, while still allowing control over the sea groups tree as a whole. It would further provide better isolation of the child, as a newly spawned cgroups space would show an empty route that only contains the child process. This would also allow more effective interaction with user namespaces, as the child namespace would only have control over itself, allowing for full control without risking the rest of the tree. This is opposed to the current limited view of the cgroups tree, which appears to have limited usefulness.
\chapter{Filling the Void}
\label{chap:filling-the-void}
Now that a completely empty set of namespaces are available for a Void Process, the ability to reinsert specific privileges must be added to support non-trivial applications. To allow for running applications as Void Processes with minimal kernel changes, this is achieved using a mixture of file-descriptor capabilities and adding elements to the empty namespaces. Capabilities allow for very explicit privilege passing where suitable, while adding elements to namespaces supports more of Linux's modern features.
\section{mount namespace}
\label{sec:filling-mount}
There are two options to provide access to files and directories in the void. Firstly, for a single file, an opened file descriptor can be offered. Consider the TLS broker of a TLS server with a persistent certificate and keyfile. Only these files are required to correctly run the application - no view of a filesystem is necessary. Providing an already opened file descriptor gives the process a capability to those files while requiring no concept of a filesystem, allowing that to remain a complete void. This is possible because of the semantics of file descriptor passing across namespaces - the file descriptor remains a capability, regardless of moving into a namespace without access to the file in question.
Alternatively, files and directories can be mounted in the Void Process's namespace. This supports three things which the capabilities do not: directories, dynamic linking, and applications which have not been adapted to use file descriptors. Firstly, the existing \texttt{openat(2)} calls are not suitable by default to treat directory file descriptors as capabilities, as they allow the search path to be absolute. This means that a process with a directory file descriptor in another namespace can access any files in that namespace [RN] by supplying an absolute path. Secondly, dynamic linking is best served by binding files, as these read only copies and the trusted binaries ensure that only the required libraries can be linked against. Finally, support for individual required files can be added by using file descriptors, but many applications will not trivially support it. Binding files allows for some backwards compatibility with applications that are more difficult to adapt.
\section{network namespace}
\label{sec:filling-net}
Reintroducing networking to a Void Process follows a similar capability-based paradigm to reintroducing files. Rather than providing the full Linux networking subsystem to a Void Process, it is instead handed a file descriptor that already has the requisite networking permissions. A capability for an inbound networking socket can be requested statically in the application's specification, which fits well with the earlier specified threat model. This socket remains open and allows the application to continuously accept requests, generating the appropriate socket for each request within the application itself. These request capabilities can be dealt with in the same process or handed back to the shim to be distributed to another Void Process.
Outbound networking is more difficult to re-add to a Void Process than inbound networking. The approach that containerisation solutions such as Docker take by default is using NAT with bridged adapters [RN]. That is, the container is provided an internal IP address that allows access to all networks via the host. Virtual machine solutions take a similar approach, creating bridged Ethernet adapters on the outside network or on a private NAT. Each of these approaches give the container/machine the appearance of unbounded outbound access, relying on firewalls to limit this afterwards. This does not fit well with the ethos of creating a Void Process - minimum privilege by default. An ideal solution would provide precise network access to the void, rather than adding all access and restricting it in post. This is achieved with inbound sockets by providing the precise and already connected socket to an otherwise empty network namespace, which does not support creating exposed inbound sockets of its own.
Consideration is given to providing outbound access with statically created and passed sockets, the same as inbound access. For example, a socket to a database could be specified in the specification, or even one per worker process. The downside of this approach is that the socket lifecycle is still handled by the kernel. While this could work well with UDP sockets, TCP sockets can fail because the remote was closed or a break in the path caused a timeout to be hit.
Given that statically giving sockets is infeasible and adding a firewall does not fit well with creating a void, I sought an alternative API. \texttt{pledge(2)} is a system call from OpenBSD which restricts future system calls to an approved set \citep{the_openbsd_foundation_pledge2_2022}. This seems like a good fit, though operating outside of the operating system makes the implementation very different. Acceptable sockets are specified in the application specification, then an interaction socket is provided to request various pre-approved sockets from the shim layer. This allows limited access to the host network, approved or denied at request time instead of by a firewall. That is, access to a precisely configured socket can be injected to the void, with a capability to request such sockets and a capability given for each socket requested.
\section{user namespace}
\label{sec:filling-user}
Filling a user namespace is a slightly odd concept compared to the namespaces already discussed in this section. As stated in Section \ref{sec:voiding-user}, a user namespace comes with no implicit mapping of users whatsoever. To enable applications to be run with bounded authority, a single mapping is added by the Void Orchestrator of \texttt{root} in the child user namespace to the launching UID in the parent namespace. This means that the user with highest privilege in the container, \texttt{root}, will be limited to the access of the launching user. The behaviour of mapping \texttt{root} to the calling user is shown with the \texttt{unshare(1)} command in Listing \ref{lst:mapped-root-directory}, where a directory owned by the calling user, \texttt{jsh77}, appears to be owned by \texttt{root} in the new namespace. A file owned by \texttt{root} in the parent namespace appears to be owned by \texttt{nobody} in the child namespace, as no mapping exists for that file's user.
\lstset{language=C,caption={A directory listing before and after entering a user namespace with mapped root.}}
\begin{lstlisting}[float,label={lst:mapped-root-directory}]
$ ls -ld repos owned_by_root
-rw-r--r-- 1 root root 0 May 7 22:13 owned_by_root
drwxrwxr-x 7 jsh77 jsh77 4096 Feb 27 17:52 repos
$ unshare -U --map-root
# ls -ld repos owned_by_root
-rw-r--r-- 1 nobody nogroup 0 May 7 22:13 owned_by_root
drwxrwxr-x 7 root root 4096 Feb 27 17:52 repos
\end{lstlisting}
The way user namespaces are currently used creates a binary system: either a file appears as owned by \texttt{root} if owned by the calling user, or appears as owned by \texttt{nobody} if not (ignoring groups for clarity, though their behaviour is similar). One questions whether more users could be mapped in, but this presents additional difficulties. Firstly, \texttt{setgroups(2)} system call must be denied to achieve correct behaviour in the child namespace. This is because the \texttt{root} user in the child namespace has full capabilities, which include \texttt{CAP\_SETGID}. This means that the user in the namespace can drop their groups, potentially allowing access to materials which the creating user did not (consider a file with permissions \texttt{0707}). This limits the utility of switching user in the child namespace, as the groups must remain the same. Secondly, mapping to users and groups other than oneself requires \texttt{CAP\_SETUID} or \texttt{CAP\_SETGID} in the parent namespace. Avoiding this is well advised to reduce the ambient authority of the shim.
Voiding the user namespace initially provides the ability to create other namespaces with ambient authority, and hides the details of the Void Process's ambient permissions from inside. Although this creates a binary system of users which may at first seem limiting, applying the context of Void Processes demonstrates that it is not. Linux itself may utilise users, groups and capabilities for process limits, but Void Processes only provide what is absolutely necessary. That is, if a process should not have access to a file owned by the same user, it is simply not made available. Running only as \texttt{root} within the Void Process is therefore not a problem - multiple users is a feature of Linux which doesn't assist Void Processes in providing minimum privilege, so is absent.
\section{Remaining namespaces}
\subsection{uts namespace}
\label{sec:filling-uts}
uts namespaces are easily voided by setting the two controlled strings to a static string. However, if one wishes for them to hold specific values, they can be set in one of two ways: either calling \texttt{sethostname(2)} or \texttt{setdomainname(2)} from within the Void Process, or by providing static values within the Void Process's specification.
\subsection{ipc namespace}
\label{sec:filling-ipc}
Filling ipc namespaces is also not possible in this context. An ipc namespace is created empty, as stated in Section \ref{sec:voiding-ipc}. IPC objects exist in one and only one ipc namespace, due to sharing what they expect to be a global namespace of keys. This means that existing IPC objects cannot be mapped into the Void Process's namespace. However, the process within the ipc namespace can use IPC objects, for example between threads. This is potentially inadvisable, because different Void Processes would provide stronger isolation than IPC within a single Void Process. Alternative IPC methods are available which use the filesystem namespace and are better shared in a controlled fashion between Void Processes.
\subsection{pid namespace}
\label{sec:filling-pid}
A created pid namespace exists by itself, with no concept of mapping in PIDs from the parent namespace. The first process created in the namespace becomes PID 1, and after that other processes can be spawned from within. As such there is no need to fill pid namespaces, instead applications can be restructured to not expect seeing other process's IDs.
\subsection{cgroup namespace}
\label{sec:filling-cgroup}
cgroup namespaces present some very interesting behaviour in this regard. What appears to be the root in the new cgroup namespace is in fact a subtree of the hierarchy in the parent. This again provides a quite strange concept of filling - elements of the tree cannot be cloned to appear in two places, by design. To provide fuller interaction with the cgroups system, one can instead bind whichever subtree they wish to act on from the parent mount namespace to the child mount namespace. This provides the control of any section of the cgroups subtree seen fit, and is unaffected by the cgroups namespace of the child. That is, the cgroups namespace is used only to provide a void, and the mount namespace can be used to operate on cgroups.
\section{Summary}
Included in the goal of minimising privilege is providing new APIs to support this. A mixed solution of capabilities, capability creating capabilities, and file system bind mounts is used to re-add privilege where necessary. Moreover, a form of interface thinning is used to ban APIs which do not well fit the model. Now that Void Processes with useful privilege can be created, Chapter \ref{chap:building-apps} presents a set of three example applications which make use of them for privilege separation.
\chapter{Building Applications}
\label{chap:building-apps}
\section{No Permissions}
The cornerstone of strong process separation is an application that is completely deprivileged. Listing \ref{lst:deprivileged-application} shows an application which, when run under the shim, drops all privileges except \texttt{stdout}. This is easy to achieve under the shim.
\lstset{language=C,caption={An application that requires only stdout and stderr.}}
\begin{lstlisting}[float,label={lst:deprivileged-application}]
#[entrypoint(stdout)]
fn main() { println!("hello world!"); }
\end{lstlisting}
\section{gzip}
GNU gzip \citep{gailly_gzip_2020} is well structured for privilege separation, though doesn't implement it by default. There is a clear split between the processing logic, selecting the items to do work on, and the compression/decompression routines, each of which are handed a pair of input and output file descriptors. This is shown by Watson et al. in \cite{watson_capsicum_2010}.
As C does not have high-level language features for multi-entrypoint applications, adapting it is slightly more verbose than the other examples seen. However, the resulting code change is still only X lines, if a bit more intricate. This places the risky compression and decompression routines in full sandboxes, while still allowing the simpler argument processing code ambient authority. The argument processing code needs no additional Linux capabilities to manage this permissioning, as the required capabilities are provided by the shim.
\section{TLS Server}
\begin{figure}
\centering
\includegraphics[width=\columnwidth]{figures/tls-server-splitting.png}
\caption{Process separation in a TLS server.}
\label{fig:tls-server-splitting}
\end{figure}
Finally, a rudimentary TLS server is created to show the rich privilege separation abilities of multi-entrypoint applications. An example structure is shown in Figure \ref{fig:tls-server-splitting}. Rather than being provided with a view of the network, the initial TCP handling process is given an already bound socket listener by the shim. This allows the TCP handler to live in an extremely restricted zero-access network namespace, while still performing the tasks of receiving new TCP connections.
Next, the TCP handler hands off the new TCP connections to the shim. Though the figure shows this as a direct connection between the TCP handler and the TLS handler, they are passed through the shim, from which the shim spawns a fresh TLS handler for each connection. The TLS handler is handed file descriptors to the certificate and key files that it requires, and hands back a decrypted request reader and an empty response writer file descriptor to the shim.
Finally, this pair of decrypted request reader and response writer are handed to a new process which handles the request. In the example case, this new process is handed a dirfd to \texttt{/var/www/html}, which is bind-mounted into an empty file system namespace by the shim. This allows the request handler enough access to serve files, while restricting access to anything else.
\chapter{Evaluation}
\label{chap:evaluation}
\todo{Write evaluation}
\section{Startup performance}
\label{sec:evaluation-startup-perf}
\todo{Write section on startup performance.}
\chapter{Conclusions}
\label{chap:conclusions}
\section{Related Work}
\subsection{Virtual Machines and Containers}
Virtual Machine solutions \citep{barham_xen_2003,vmware_inc_understanding_2008} provide the ability to split a single machine into multiple virtual machines. When placing a single application in each virtual machine, they are effectively isolated from one another. Full fat container solutions such as Docker \citep{merkel_docker_2014}, containerd [CN], and systemd-nspawn [CN] provide mechanisms to isolate an application almost completely from other applications running on a single machine. Some have claimed that this provides isolation superior to virtual machines \citep{soltesz_container-based_2007}.
Both of these solutions are less effective at isolating parts of an application from itself [CN with research]. Consider running only a TLS web server in a virtual machine. Although other applications will be unable to access the certificates, as they are in different virtual machines, methods within the application that should not be able to access the certificates still can.
While virtual machines and containers provide a strong isolation at the application level, they are not a compelling solution to intra-application privilege separation.
\subsection{systemd}
\texttt{systemd} [CN] provides a declarative interface to all of the process separation techniques used in this work. Rather than the responsibility of the programmer, creating these declarative descriptions is most commonly left to the package maintainers. This work seeks to provide similar capabilities to the people best suited to privilege separating an application: the developers.
\section{Future Work}
\subsection{Kernel API improvements}
The primary future work to increase the utility of void processes is better performance when creating empty namespaces. Section \ref{sec:evaluation-startup-perf} showed that the startup hit when creating the namespaces for a void is very high. This shows a limitation of the APIs, as creating a namespace that has no relation to a parent should involve a small amount of work. Secondly, an API similar to network namespaces adding paired interfaces between namespaces should be added for binding in mount namespaces, allowing mount namespaces to also be created completely empty. This would also benefit containers which by default have no connection to the parent namespace, but need to mount in their own root filesystem.
\subsection{Dynamic linking}
Dynamic linking works correctly under the shim, however, it currently requires a high level of manual input. Given that the threat model in Section \ref{section:threat-model} specifies trusted binaries, it is feasible to add a pre-spawning phase which appends read-only libraries to the specification for each spawned process automatically before creating appropriate voids. This would allow anything which can link correctly on the host system to link correctly in Void Processes.
\section{Conclusion}
\todo{Write conclusion}
\appendix
\singlespacing
\bibliographystyle{unsrt}
\bibliography{references}
\end{document}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 677 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

BIN
graphs/fib_startup.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
graphs/tls_performance.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
logo-dcst-colour.pdf Normal file

Binary file not shown.

37
makefile Normal file
View File

@ -0,0 +1,37 @@
# requires GNU make
SHELL=/bin/bash
.DELETE_ON_ERROR:
%.pdf %.aux %.idx: %.tex
pdflatex -halt-on-error -file-line-error $<
while grep 'Rerun to get ' $*.log ; do pdflatex -halt-on-error $< ; done
%.ind: %.idx
makeindex $*
%.bbl: %.aux
bibtex $*
%.pdftex %.pdftex_t: %.fig
fig2dev -L pdftex_t -p $*.pdftex $< $*.pdftex_t
fig2dev -L pdftex $< $*.pdftex
all: report.pdf report-submission.pdf
report-submission.tex: report.tex
sed -e 's/^%\(\\submissiontrue\)/\1/' $< >$@
report.pdf: logo-dcst-colour.pdf
# extract number of first and last page of the main chapters from the AUX file
WORDCOUNT_FILE=report-submission
FIRSTPAGE?=$(shell sed -ne 's/^\\newlabel{firstcontentpage}{{[0-9]*}{\([0-9]*\)}.*/\1/p' $(WORDCOUNT_FILE).aux)
LASTPAGE ?=$(shell sed -ne 's/^\\newlabel{lastcontentpage}{{[0-9]*}{\([0-9]*\)}.*/\1/p' $(WORDCOUNT_FILE).aux)
# requires ghostscript
wordcount: $(WORDCOUNT_FILE).pdf
gs -q -dSAFER -sDEVICE=txtwrite -o - \
-dFirstPage=$(FIRSTPAGE) -dLastPage=$(LASTPAGE) $< | \
egrep '[A-Za-z]{3}' | wc -w
clean:
rm -f *.log *.aux *.toc *.bbl *.ind *.lot *.lof *.out *~
rm -f report-submission.tex

View File

@ -1,4 +1,65 @@
@misc{linux_kernel_newbies_editors_linux_2020,
type = {Wiki},
title = {Linux {Version} 5.6 {Changelog}},
url = {https://kernelnewbies.org/Linux_5.6},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
author = {Linux Kernel Newbies Editors},
month = mar,
year = {2020},
}
@misc{linux_kernel_newbies_editors_linux_2008,
type = {Wiki},
title = {Linux {Version} 2.6.24 {Changelog}},
url = {https://kernelnewbies.org/Linux_2_6_24},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
author = {Linux Kernel Newbies Editors},
month = jan,
year = {2008},
}
@misc{linux_kernel_newbies_editors_linux_2007,
type = {Wiki},
title = {Linux {Version} 2.6.23 {Changelog}},
url = {https://kernelnewbies.org/Linux_2_6_23},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
author = {Linux Kernel Newbies Editors},
month = oct,
year = {2007},
}
@misc{linux_kernel_newbies_editors_linux_2006,
type = {Wiki},
title = {Linux {Version} 2.6.19 {Changelog}},
url = {https://kernelnewbies.org/Linux_2_6_19},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
author = {Linux Kernel Newbies Editors},
month = nov,
year = {2006},
}
@inproceedings{accetta_mach_1986,
title = {Mach: {A} {New} {Kernel} {Foundation} for {UNIX} {Development}},
booktitle = {Proceedings of the {USENIX} {Summer} {Conference}, {Altanta}, {GA}, {USA}, {June} 1986},
publisher = {USENIX Association},
author = {Accetta, Michael J. and Baron, Robert V. and Bolosky, William J. and Golub, David B. and Rashid, Richard F. and Tevanian, Avadis and Young, Michael},
year = {1986},
pages = {93--113},
}
@article{accetta_mach_nodate,
title = {Mach: {A} {New} {Kernel} {Foundation} {For} {UNIX} {Development}},
abstract = {Mach is a multiprocessor operating system kernel and environment under development at Carnegie Mellon University. Mach provides a new foundation for UNIX development that spans networks of uniprocessors and multiprocessors. This paper describes Mach and the motivations that led to its design. Also described are some of the details of its implementation and current status.},
language = {en},
author = {Accetta, Mike and Baron, Robert and Bolosky, William and Golub, David and Rashid, Richard and Tevanian, Avadis and Young, Michael},
pages = {16},
}
@misc{the_openbsd_foundation_openssh_2022,
title = {{OpenSSH} 8.9 {Release} {Notes}},
url = {https://www.openssh.com/txt/release-8.9},
@ -200,46 +261,6 @@ namespaces. This infrastructure is:
year = {2006},
}
@misc{noauthor_linux_2020,
type = {Wiki},
title = {Linux {Version} 5.6 {Changelog}},
url = {https://kernelnewbies.org/Linux_5.6},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
month = mar,
year = {2020},
}
@misc{noauthor_linux_2008,
type = {Wiki},
title = {Linux {Version} 2.6.24 {Changelog}},
url = {https://kernelnewbies.org/Linux_2_6_24},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
month = jan,
year = {2008},
}
@misc{noauthor_linux_2007,
type = {Wiki},
title = {Linux {Version} 2.6.23 {Changelog}},
url = {https://kernelnewbies.org/Linux_2_6_23},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
month = oct,
year = {2007},
}
@misc{noauthor_linux_2006,
type = {Wiki},
title = {Linux {Version} 2.6.19 {Changelog}},
url = {https://kernelnewbies.org/Linux_2_6_19},
urldate = {2022-04-20},
journal = {Linux Kernel Newbies},
month = nov,
year = {2006},
}
@misc{torvalds_linux_2002,
title = {Linux {Kernel} {Version} 2.5.2 {Changelog}},
url = {https://mirrors.edge.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.2},

1079
report.tex Normal file

File diff suppressed because it is too large Load Diff

15
src/fib/main.rs Normal file
View File

@ -0,0 +1,15 @@
fn main() {
println!("fib(1) = {}", fib(1));
println!("fib(7) = {}", fib(7));
println!("fib(19) = {}", fib(19));
}
fn fib(i: u64) -> u64 {
let (mut a, mut b) = (0, 1);
for _ in 0..i {
(a, b) = (b, a + b);
}
a
}

27
src/fib/spec.json Normal file
View File

@ -0,0 +1,27 @@
{
"entrypoints": {
"fib": {
"environment": [
"Stdout",
{
"Filesystem": {
"host_path": "/lib/x86_64-linux-gnu/libgcc_s.so.1",
"environment_path": "/lib/libgcc_s.so.1"
}
},
{
"Filesystem": {
"host_path": "/lib/x86_64-linux-gnu/libc.so.6",
"environment_path": "/lib/libc.so.6"
}
},
{
"Filesystem": {
"host_path": "/lib64/ld-linux-x86-64.so.2",
"environment_path": "/lib64/ld-linux-x86-64.so.2"
}
}
]
}
}
}

42
src/pipes/main.rs Normal file
View File

@ -0,0 +1,42 @@
use std::fs::File;
use std::io::Write;
fn main() {
use std::os::unix::io::FromRawFd;
let mut args = std::env::args();
let _bin = args.next();
match args.next() {
Some(s) => match s.as_str() {
"pipe_sender" => {
let fd: i32 = args.next().unwrap().parse().unwrap();
pipe_sender(unsafe { File::from_raw_fd(fd) })
}
"pipe_receiver" => {
let pipe_data = args.next().unwrap();
pipe_receiver(pipe_data.as_str())
}
_ => unimplemented!(),
},
None => unimplemented!(),
}
}
fn pipe_sender(mut tx_pipe: File) {
println!("hello from pipe_sender!");
let data = b"some data";
let bytes_written = tx_pipe.write(&data[..]).unwrap();
assert!(bytes_written == data.len());
let data = b"some more data";
let bytes_written = tx_pipe.write(&data[..]).unwrap();
assert!(bytes_written == data.len());
}
fn pipe_receiver(rx_data: &str) {
println!("hello from pid: {}", std::process::id());
println!("received data: {}", rx_data);
}

25
src/pipes/spec.json Normal file
View File

@ -0,0 +1,25 @@
{
"entrypoints": {
"pipe_sender": {
"args": [
"BinaryName",
"Entrypoint",
{
"Pipe": {
"Tx": "messages"
}
}
]
},
"pipe_receiver": {
"trigger": {
"Pipe": "messages"
},
"args": [
"BinaryName",
"Entrypoint",
"PipeTrigger"
]
}
}
}

61
src/tls/http.rs Normal file
View File

@ -0,0 +1,61 @@
use std::fs;
use std::io::{Read, Write};
use std::net::TcpStream;
use std::path::PathBuf;
pub(super) fn handler(mut stream: TcpStream) -> i32 {
println!("entered http handler");
let mut buf = Vec::new();
loop {
let buf_len = buf.len();
buf.resize_with(buf_len + 1024, Default::default);
if stream.read(&mut buf[buf_len..]).unwrap() == 0 {
break;
}
let mut headers = [httparse::EMPTY_HEADER; 64];
let mut req = httparse::Request::new(&mut headers);
let result = req.parse(&buf).unwrap();
if result.is_partial() {
continue;
}
let filename = if req.method != Some("GET") {
None
} else {
req.path
};
let status_line = if filename.is_some() {
"HTTP/1.1 200 OK"
} else {
"HTTP/1.1 404 NOT FOUND"
};
let contents = if let Some(filename) = filename {
fs::read_to_string(
PathBuf::from("/var/www/html/")
.join(filename.strip_prefix('/').unwrap_or(filename)),
)
.unwrap()
} else {
"content not found\n".to_string()
};
let response_header = format!(
"{}\r\nContent-Length: {}\r\n\r\n",
status_line,
contents.len(),
);
stream.write_all(response_header.as_bytes()).unwrap();
stream.write_all(contents.as_bytes()).unwrap();
break;
}
exitcode::OK
}

109
src/tls/main.rs Normal file
View File

@ -0,0 +1,109 @@
mod http;
use std::fs::File;
use std::net::{TcpListener, TcpStream};
fn main() {
let mut args = std::env::args();
let _bin = args.next();
let entrypoint = args.next();
match entrypoint {
Some(s) => match s.as_str() {
"connection_listener" => connection_listener_entrypoint(),
"http_handler" => http_handler_entrypoint(),
_ => unimplemented!(),
},
None => unimplemented!(),
}
}
fn connection_listener_entrypoint() {
// imports
use std::os::unix::io::{FromRawFd, RawFd};
// argument parsing
let mut args = std::env::args();
let _bin = args.next();
let _entrypoint = args.next();
let http_handler_trigger = args.next();
let http_handler_trigger: RawFd = http_handler_trigger
.expect("request handler required")
.parse()
.expect("tcp listener should be a file descriptor");
let http_handler_trigger = unsafe { File::from_raw_fd(http_handler_trigger) };
let tcp_listener = args.next();
let tcp_listener: RawFd = tcp_listener
.expect("tcp listener required")
.parse()
.expect("tcp listener should be a file descriptor");
let tcp_listener = unsafe { TcpListener::from_raw_fd(tcp_listener) };
// actual function body
fn connection_listener(http_handler_trigger: File, tcp_listener: TcpListener) -> i32 {
println!("connection_listener entered");
// handle incoming connections
for stream in tcp_listener.incoming() {
let stream = match stream {
Ok(s) => s,
Err(e) => {
println!("connection listener: error: {}", e);
return 1;
}
};
println!("received a new connection");
http_handler(&http_handler_trigger, stream);
}
exitcode::OK
}
// run function
std::process::exit(connection_listener(http_handler_trigger, tcp_listener));
}
fn http_handler(trigger_socket: &File, stream: TcpStream) {
// imports
use nix::sys::socket::{sendmsg, ControlMessage, MsgFlags};
use std::os::unix::io::AsRawFd;
// send file descriptor(s)
let sockfd = trigger_socket.as_raw_fd();
let fds = [stream.as_raw_fd()];
sendmsg::<()>(
sockfd,
&[],
&[ControlMessage::ScmRights(&fds)],
MsgFlags::empty(),
None,
)
.unwrap();
}
fn http_handler_entrypoint() {
// imports
use std::os::unix::io::{FromRawFd, RawFd};
// argument parsing
let mut args = std::env::args();
let _bin = args.next();
let _entrypoint = args.next();
let stream = args.next();
let stream: RawFd = stream
.expect("request stream required")
.parse()
.expect("request stream should be a file descriptor");
let stream = unsafe { TcpStream::from_raw_fd(stream) };
std::process::exit(http::handler(stream));
}

76
src/tls/spec.json Normal file
View File

@ -0,0 +1,76 @@
{
"entrypoints": {
"connection_listener": {
"args": [
"BinaryName",
"Entrypoint",
{
"FileSocket": {
"Tx": "http"
}
},
{
"TcpListener": {
"addr": "0.0.0.0:8443"
}
}
],
"environment": [
{
"Filesystem": {
"host_path": "/lib/x86_64-linux-gnu/libgcc_s.so.1",
"environment_path": "/lib/libgcc_s.so.1"
}
},
{
"Filesystem": {
"host_path": "/lib/x86_64-linux-gnu/libc.so.6",
"environment_path": "/lib/libc.so.6"
}
},
{
"Filesystem": {
"host_path": "/lib64/ld-linux-x86-64.so.2",
"environment_path": "/lib64/ld-linux-x86-64.so.2"
}
}
]
},
"http_handler": {
"trigger": {
"FileSocket": "http"
},
"args": [
"BinaryName",
"Entrypoint",
"Trigger"
],
"environment": [
{
"Filesystem": {
"host_path": "/var/www/html",
"environment_path": "/var/www/html"
}
},
{
"Filesystem": {
"host_path": "/lib/x86_64-linux-gnu/libgcc_s.so.1",
"environment_path": "/lib/libgcc_s.so.1"
}
},
{
"Filesystem": {
"host_path": "/lib/x86_64-linux-gnu/libc.so.6",
"environment_path": "/lib/libc.so.6"
}
},
{
"Filesystem": {
"host_path": "/lib64/ld-linux-x86-64.so.2",
"environment_path": "/lib64/ld-linux-x86-64.so.2"
}
}
]
}
}
}

View File

@ -1,56 +0,0 @@
% title page information
\begin{titlepage}
\begin{center}
\noindent
\huge
\dissertationtitle \\
\vspace*{\stretch{1}}
\end{center}
\begin{center}
\noindent
\huge
\authorname \\
\Large
\authorcollege \\[24pt]
%\begin{figure}
\includegraphics{CUni3.pdf}
%\end{figure}
\end{center}
\vspace{24pt}
\begin{center}
\noindent
\large
{\it A dissertation submitted to the University of Cambridge \\
in partial fulfilment of the requirements for Part III of the
Computer Science Tripos.}
\vspace*{\stretch{1}}
\end{center}
\begin{center}
\noindent
University of Cambridge \\
Computer Laboratory \\
William Gates Building \\
15 JJ Thomson Avenue \\
Cambridge CB3 0FD \\
{\sc United Kingdom} \\
\end{center}
\begin{center}
\noindent
Email: \authoremail \\
\end{center}
\begin{center}
\noindent
\today
\end{center}
\end{titlepage}
\newpage
\vspace*{\fill}