You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: body.tex
+43-11Lines changed: 43 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -570,20 +570,52 @@ \subsubsection{Declassification of the blocking level}
570
570
\code{pinipop} dynamically scope the part of the execution for which the blocking label is declassified.
571
571
572
572
573
-
\subsection{Information flow control in I/O}
574
-
\subsubsection{Generalized receive}
575
-
Because receive operation changes the state of the mailbox, Troupe supports several forms
576
-
of receive statement that was introduced earlier in Section~\ref{sec:concurrency}. The most
577
-
general form for receiving is \code{rcv(lev1,lev2,auth,hns)}. Here, \code{lev1} and \code{lev2}
578
-
indicate the to and from-levels of the pc-tags on the messages, and \code{auth} is the authority
579
-
argument.
573
+
\subsection{Information flow control with I/O primitives}
574
+
\subsubsection{Generalized receive and mailbox clearances}
575
+
576
+
I/O operations such as send and receive introduce additional concerns w.r.t.
577
+
information flow control. In particular, because mailbox acts as a mutable state, an extra
578
+
care needs to be taken to control information flows through the mailbox structure.
579
+
580
+
581
+
Every message in a mailbox carries an extra label -- the blocking level of the sender.
582
+
Receiving a value furthermore propagates the taint of the blocking level from the sender to the receiver.
583
+
In order to constrain a receive operation from an accidental raise of the blocking level, Troupe
584
+
provides a general receive primitive in the form
585
+
\code{rcv(lev1,lev2,hns)}. Here, \code{lev1} and \code{lev2}
586
+
indicate the to and from-levels of the pc-tags on the messages, and \code{hns} is the list of
587
+
handlers as before.
588
+
The \code{receive} operation we introduced earlier is equivalent to \code{rcvp}
589
+
at the level of the current pc label.
590
+
591
+
While such a form of general receive over an interval of levels is useful, it is also too powerful
592
+
and needs to be further constrained. Consider the following snippet
593
+
594
+
595
+
\begin{lstlisting}
596
+
let val _ = if (secret) then rcv ({}, {alice}, [hn x => x] else ()
597
+
in val x = rcv ({}, {}, [hn x => x ])
598
+
end
599
+
\end{lstlisting}
600
+
601
+
Because the receive in the high branch is on an interval, the value of \code{x} may
602
+
depend on the secret value. In general, one can encode an entire secret in the structure
603
+
of the mailbox. To prevent such programs, Troupe provides a special notion of \emph{mailbox clearance}
604
+
that constrains receives on an interval. The mailbox clearance is a proxy for an authority.
605
+
It can be raised using a dedicated command \code{raisembox (lev)} that returns a lowering
606
+
capability and lowered with command \code{lowermbox(c, authority)}.
607
+
There are two main constraints related to the mailbox clearance.
608
+
609
+
\begin{enumerate}
610
+
\item First, at the time of the receive on an interval $(\ell_1, \ell_2)$ under context $\mathit{pc}$
611
+
with mailbox clearance at $\ell_{\mathit{clear}}$ it must be that $\ell_2\sqcup\mathit{pc} \sqsubseteq\ell_1\sqcup\ell_{\mathit{clear}}$.
612
+
This constraint ensures that the mailbox clearance is sufficient for the interval receives. When mailbox clearance is $\bot$ -- as it is in the beginning of the program -- this means that only point intervals of the form $(\ell, \ell)$ s.t. $\mathit{pc} \sqsubseteq\ell$ are allowed.
613
+
614
+
\item
615
+
\end{enumerate}
580
616
581
617
582
618
583
-
Note that if \code{lev1} and \code{lev2} coincide then the authority argument
584
-
is not required. In such cases, one can use a special form of receive \code{rcvp}.
585
-
Finally, note that the \code{receive} operation we introduced earlier is equivalent to \code{rcvp}
0 commit comments