lio- Labeled IO Information Flow Control Library

Safe HaskellUnsafe




This module implements the core of labeled IORefs in the 'LIO ad. to Data.IORef, but the operations take place in the LIO monad. The types and functions exported by this module are strictly TCB and do not perform any information flow checks. The external, safe interface is provided and documented in LIO.LIORef.

Different from many labeled objects (e.g., files or MVars), references are uni-directional. This means that reading from a reference can be done without being able to write to it; and writing to a refernece can be done without raising the current label, as if also performing a read.



data LIORef l a Source

An LIORef is an IORef with an associated, fixed label. The restriction to an immutable label come from the fact that it is possible to leak information through the label itself, if we wish to allow LIORef to be an instance of LabelOf. Of course, you can create an LIORef of Labeled to get a limited form of flow-sensitivity.




labelOfLIORef :: !l

Label of the labeled IORef.

unlabelLIORefTCB :: IORef a

Access the underlying IORef, ignoring IFC.


LabelOf LIORef

Get the label of an LIORef.

Basic Functions

Create labeled IORefs

newLIORefTCB :: MonadLIO l m => l -> a -> m (LIORef l a)Source

Trusted constructor that creates labeled references with the given label without any IFC checks.

Read LIORefs

readLIORefTCB :: MonadLIO l m => LIORef l a -> m aSource

Trusted function used to read the value of a reference without raising the current label.

Write LIORefs

writeLIORefTCB :: MonadLIO l m => LIORef l a -> a -> m ()Source

Trusted function used to write a new value into a labeled reference, ignoring IFC.

Modify LIORefs

modifyLIORefTCB :: MonadLIO l m => LIORef l a -> (a -> a) -> m ()Source

Trusted function that mutates the contents on an LIORef, ignoring IFC.

atomicModifyLIORefTCB :: MonadLIO l m => LIORef l a -> (a -> (a, b)) -> m bSource

Trusted function used to atomically modify the contents of a labeled reference, ignoring IFC.