vestigia-0.2.0: Where an execution depended on a secret.
Copyright(c) 2026 Jared Tobin
LicenseMIT
MaintainerJared Tobin <jared@ppad.tech>
Safe HaskellNone
LanguageHaskell2010

Vestigia.Trace

Description

A run's leakage, read from what memcheck reported. An error whose undefined value was created by a client request descends from a byte the harness marked secret, so it is a site where the execution depended on the secret: a branch (control), an address computed from it (address), an integer division's operand (operand, from vestigia's patched memcheck), or a system call handed it (syscall). Every other uninitialised read is kept apart as unrelated, and memory errors as faults: neither says anything about the secret. Leak reports say nothing about the execution and are dropped.

memcheck sees the path a run took, so runs of one harness on several secrets are read together: a site is one instruction and class however many runs reached it, with the runs that did. Where a run's objects are known, a site is named by its address in its object, so runs that loaded an object apart still agree on it.

Synopsis

Documentation

data Class Source #

How an execution depended on a secret at a site.

Constructors

Control 
Address 
Operand 
Syscall 

Instances

Instances details
Show Class Source # 
Instance details

Defined in Vestigia.Trace

Methods

showsPrec :: Int -> Class -> ShowS #

show :: Class -> String #

showList :: [Class] -> ShowS #

Eq Class Source # 
Instance details

Defined in Vestigia.Trace

Methods

(==) :: Class -> Class -> Bool #

(/=) :: Class -> Class -> Bool #

Ord Class Source # 
Instance details

Defined in Vestigia.Trace

Methods

compare :: Class -> Class -> Ordering #

(<) :: Class -> Class -> Bool #

(<=) :: Class -> Class -> Bool #

(>) :: Class -> Class -> Bool #

(>=) :: Class -> Class -> Bool #

max :: Class -> Class -> Class #

min :: Class -> Class -> Class #

data Taint Source #

One run under memcheck: its name, what memcheck reported, where the harness's loader put each object (its load bias and path, as the harness reported them; none for a report made elsewhere), and the harness's exit status, where known.

Constructors

Taint 

Fields

Instances

Instances details
Show Taint Source # 
Instance details

Defined in Vestigia.Trace

Methods

showsPrec :: Int -> Taint -> ShowS #

show :: Taint -> String #

showList :: [Taint] -> ShowS #

Eq Taint Source # 
Instance details

Defined in Vestigia.Trace

Methods

(==) :: Taint -> Taint -> Bool #

(/=) :: Taint -> Taint -> Bool #

data Located Source #

A frame, with its address in its object where its run's objects say.

Constructors

Located 

Fields

Instances

Instances details
Show Located Source # 
Instance details

Defined in Vestigia.Trace

Eq Located Source # 
Instance details

Defined in Vestigia.Trace

Methods

(==) :: Located -> Located -> Bool #

(/=) :: Located -> Located -> Bool #

data Site Source #

One instruction that depended on a secret: where, as the first run to reach it saw it; how many times, over every run; the runs that reached it, as indices into the runs; and every stack that did.

Constructors

Site 

Fields

Instances

Instances details
Show Site Source # 
Instance details

Defined in Vestigia.Trace

Methods

showsPrec :: Int -> Site -> ShowS #

show :: Site -> String #

showList :: [Site] -> ShowS #

Eq Site Source # 
Instance details

Defined in Vestigia.Trace

Methods

(==) :: Site -> Site -> Bool #

(/=) :: Site -> Site -> Bool #

data Trace Source #

Runs' sites, in the order first reported, and what memcheck reported that says nothing about the secret, each with the index of the run that reported it.

Constructors

Trace 

Fields

Instances

Instances details
Show Trace Source # 
Instance details

Defined in Vestigia.Trace

Methods

showsPrec :: Int -> Trace -> ShowS #

show :: Trace -> String #

showList :: [Trace] -> ShowS #

Eq Trace Source # 
Instance details

Defined in Vestigia.Trace

Methods

(==) :: Trace -> Trace -> Bool #

(/=) :: Trace -> Trace -> Bool #

trace :: [Taint] -> Trace Source #

The runs' leakage. Sites are one per instruction and class: memcheck reports one context per distinct stack, and the instruction is what depended on the secret, whatever called it and in whichever run.

sitesIn :: [Text] -> Trace -> Trace Source #

Only the sites in objects whose path contains one of the given texts, as a differential run keeps its origins; every site when none is given.

readObjects :: Text -> Either String [(Integer, Text)] Source #

The objects file the harness's first mark writes: a load bias (hex) and a path per line.

>>> readObjects "7f0000 /lib/libc.so.6\n400000 /bin/harness\n"
Right [(8323072,"/lib/libc.so.6"),(4194304,"/bin/harness")]

resolveObjects :: [(Integer, Text)] -> IO [(Integer, Text)] Source #

A frame's address in its object, where the harness reported the object: by its path, else by its file name. | A run's objects, each path resolved to the file it names, as memcheck names a frame's object: a loader reaches a library by the link its soname names, memcheck by the file the link leads to. A path that names nothing here, as in a report made elsewhere, is kept as reported.

traceJson :: Text -> Trace -> Value Source #

The report: vestigia/trace-v2.

traceSummary :: Trace -> Text Source #

One line per site, for a reader at a terminal: with how many runs reached it, where there were several.