Documentation ¶
Overview ¶
taintatticePointer is a taint lattice which also holds the pointer for every ssa.Valuer
Index ¶
- Variables
- func IsIndirectPtr(i ssa.Value) (canPoint bool, val ssa.Value)
- func IsPointerVal(i ssa.Value) (canPoint bool, val ssa.Value)
- func NewErrInFlow(c *ssa.CallCommon, a []ssa.Value, e error) error
- func Read(fileName string) error
- type Data
- type ErrLeak
- type Lattice
- func (l1 Lattice) BottomLattice() lattice.Latticer
- func (l1 Lattice) DeepCopy() lattice.Latticer
- func (l1 Lattice) Equal(l2 lattice.Latticer) (equal bool, err error)
- func (l1 Lattice) GetVal(key ssa.Value) lattice.Valuer
- func (l1 Lattice) Greater(l2 lattice.Latticer) (bool, error)
- func (l1 Lattice) GreaterEqual(l2 lattice.Latticer) (greatereq bool, err error)
- func (l1 Lattice) GreatestLowerBound(l2 lattice.Latticer) (lattice.Latticer, error)
- func (l1 Lattice) LeastElement() (lattice.Latticer, error)
- func (l1 Lattice) LeastUpperBound(l2 lattice.Latticer) (lattice.Latticer, error)
- func (l1 Lattice) Less(l2 lattice.Latticer) (bool, error)
- func (l1 Lattice) LessEqual(l2 lattice.Latticer) (lesseq bool, err error)
- func (l1 Lattice) SetVal(key ssa.Value, value lattice.Valuer) error
- func (l1 Lattice) String() string
- func (l Lattice) TransferFunction(node ssa.Instruction, ptr *pointer.Result) transferFunction.PlainFF
- type LatticePointer
- func (l1 *LatticePointer) BottomLattice() lattice.Latticer
- func (l1 *LatticePointer) DeepCopy() lattice.Latticer
- func (l1 *LatticePointer) Equal(l2 lattice.Latticer) (bool, error)
- func (l1 *LatticePointer) GetLat() lattice.Latticer
- func (l1 *LatticePointer) GetPtr(key ssa.Value) pointer.Pointer
- func (l1 *LatticePointer) GetPtrs() map[ssa.Value]pointer.Pointer
- func (l1 *LatticePointer) GetSSAValMayAlias(v ssa.Value) []ssa.Value
- func (l1 *LatticePointer) GetVal(key ssa.Value) lattice.Valuer
- func (l1 *LatticePointer) Greater(l2 lattice.Latticer) (bool, error)
- func (l1 *LatticePointer) GreaterEqual(l2 lattice.Latticer) (bool, error)
- func (l1 *LatticePointer) GreatestLowerBound(l2 lattice.Latticer) (lattice.Latticer, error)
- func (l1 *LatticePointer) LeastElement() (lattice.Latticer, error)
- func (l1 *LatticePointer) LeastUpperBound(l2 lattice.Latticer) (lattice.Latticer, error)
- func (l1 *LatticePointer) Less(l2 lattice.Latticer) (bool, error)
- func (l1 *LatticePointer) LessEqual(l2 lattice.Latticer) (bool, error)
- func (l1 *LatticePointer) SetPtr(key ssa.Value, ptr pointer.Pointer)
- func (l1 *LatticePointer) SetPtrs(m map[ssa.Value]pointer.Pointer)
- func (l1 *LatticePointer) SetVal(key ssa.Value, value lattice.Valuer) error
- func (l1 *LatticePointer) String() string
- func (l1 *LatticePointer) TransferFunction(node ssa.Instruction, ptr *pointer.Result) transferFunction.PlainFF
- type Value
- func (tlv Value) BottomElement() lattice.Valuer
- func (tlv Value) Equal(lv lattice.Valuer) (bool, error)
- func (tlv Value) Greater(lv lattice.Valuer) (bool, error)
- func (tlv Value) GreaterEqual(lv lattice.Valuer) (greatereq bool, err error)
- func (tlv Value) GreatestLowerBound(lv lattice.Valuer) (lattice.Valuer, error)
- func (tlv Value) LeastUpperBound(lv lattice.Valuer) (lattice.Valuer, error)
- func (tlv Value) Less(lv lattice.Valuer) (bool, error)
- func (tlv Value) LessEqual(lv lattice.Valuer) (lesseq bool, err error)
- func (tlv Value) String() string
- func (tlv Value) TopElement() lattice.Valuer
Constants ¶
This section is empty.
Variables ¶
var Sinks = make([]*Data, 0)
Sinks contains a slice of TaintData which are sinks.
var Sources = make([]*Data, 0)
Sources contains a slice of TaintData which are sources.
Functions ¶
func IsIndirectPtr ¶
IsIndirectPtr checks whether the value is an indirect pointer value In the positive case the function returns the ssa.Value.
func IsPointerVal ¶
IsPointerVal checks whether the value is a pointer value and in the positive case it returns the ssa.Value For some instructions like a *ssa.Call it is requuired to go deeper. TODO check whether it is also required for other cases
func NewErrInFlow ¶
NewErrInFlow returns a error of type ErrInFlow.
Types ¶
type Data ¶
type Data struct {
// contains filtered or unexported fields
}
Data is holds the signature and the callee of a source or sink.
func (*Data) IsInterface ¶
IsInterface returns true if t contains the signature of an interface and not of an concrete type
type ErrLeak ¶
type ErrLeak struct { Call ssa.CallCommon Args []ssa.Value Err error }
ErrInFlow is an error type which holds an information flow. It can be used to report flows from sources to sinks to the user.
type Lattice ¶
Lattice is data structure (map) which maps a ssa.Value to the abstract value. ssa.Value is an interface -> no pointer needed because it's already a pointer.
func NewLattice ¶
NewLattice returns a new lattice with length len.
func (Lattice) BottomLattice ¶
BottomLattice sets for all elements of the lattice the value to empty.
func (Lattice) Equal ¶
Equal compares l1 against l2 on equality. Throws an error if l2 is not of type taint.Lattice.
func (Lattice) GetVal ¶
GetVal returns the value of key from the lattice. Empty will be returned if the key is not in the lattice. In such a case we set manually the value of these element to Empty.
func (Lattice) Greater ¶
Greater computes: l1 > l2. Throws an error if t2 is not of type taint.Lattice.
func (Lattice) GreaterEqual ¶
GreaterEqual computes: l1 >= l2
func (Lattice) GreatestLowerBound ¶
GreatestLowerBound computes the greatest lower bound of two lattices. In the current implementation an error (ErrOnlyTaintLatAcc) will be returned if l2 is not of type taint.Lattice The function supports all intances of Latticer which returns a lattice when called with getTaintLattice. TODO optimized version is in lub -> merge into one function with higher order funcitons
func (Lattice) LeastElement ¶
LeastElement returns a Lattice in which each element of l1 is set to the lowest abstract value of Valuer being Empty
func (Lattice) LeastUpperBound ¶
LeastUpperBound creates the leastUpperBound of two Lattices. In the current implementation an error (ErrOnlyTaintLatAcc) will be returned if l2 is not of type taint.Lattice The function supports all intances of Latticer which returns a lattice when called with getTaintLattice.
func (Lattice) Less ¶
Less computes whether l1 is less than l2. Throws an error if l2 is not of type taint.Lattice.
func (Lattice) LessEqual ¶
LessEqual computes: l1 <= l2. Throws an error if t2 is not of type taint.Lattice.
func (Lattice) TransferFunction ¶
func (l Lattice) TransferFunction(node ssa.Instruction, ptr *pointer.Result) transferFunction.PlainFF
TransferFunction handels a normal transfer of an instruction. Returns nil if an error occurs.
type LatticePointer ¶
type LatticePointer struct {
// contains filtered or unexported fields
}
LatticePointer is an instance of Pter and extends Lattice with pointer information
func NewLatticePointer ¶
func (*LatticePointer) BottomLattice ¶
func (l1 *LatticePointer) BottomLattice() lattice.Latticer
func (*LatticePointer) DeepCopy ¶
func (l1 *LatticePointer) DeepCopy() lattice.Latticer
func (*LatticePointer) GetLat ¶
func (l1 *LatticePointer) GetLat() lattice.Latticer
func (*LatticePointer) GetSSAValMayAlias ¶
func (l1 *LatticePointer) GetSSAValMayAlias(v ssa.Value) []ssa.Value
func (*LatticePointer) Greater ¶
func (l1 *LatticePointer) Greater(l2 lattice.Latticer) (bool, error)
func (*LatticePointer) GreaterEqual ¶
func (l1 *LatticePointer) GreaterEqual(l2 lattice.Latticer) (bool, error)
func (*LatticePointer) GreatestLowerBound ¶
func (*LatticePointer) LeastElement ¶
func (l1 *LatticePointer) LeastElement() (lattice.Latticer, error)
func (*LatticePointer) LeastUpperBound ¶
func (*LatticePointer) LessEqual ¶
func (l1 *LatticePointer) LessEqual(l2 lattice.Latticer) (bool, error)
func (*LatticePointer) SetPtr ¶
func (l1 *LatticePointer) SetPtr(key ssa.Value, ptr pointer.Pointer)
func (*LatticePointer) String ¶
func (l1 *LatticePointer) String() string
func (*LatticePointer) TransferFunction ¶
func (l1 *LatticePointer) TransferFunction(node ssa.Instruction, ptr *pointer.Result) transferFunction.PlainFF
type Value ¶
type Value int
Value represents a taint Value
func LUPOverLabels ¶
func LUPOverLabels(ptstoset pointer.PointsToSet, l Lattice) (val Value, e error)
LUPOverLabels iterates through all labels of a pointsToSet and returns the result of the LUP.
func (Value) BottomElement ¶
BottomElement returns the lowest element of the lattice.
func (Value) Equal ¶
Equal returns tlv == lv. Returns an error (ErrOnlyTaintValueAcc) if lv is not a taint.Value.
func (Value) GreaterEqual ¶
GreaterEqual returns tlv >= lv. Returns an error if lv is not of type taint.Value.
func (Value) GreatestLowerBound ¶
GreatestLowerBound build the greatest lower bound of tlv and lv. Returns an error (ErrOnlyTaintValueAcc) if lv is not a taint.Value.
func (Value) LeastUpperBound ¶
LeastUpperBound build the least upper bound of tlv and lv. Returns an error (ErrOnlyTaintLatAcc) if lv is not a taint.Value.
func (Value) Less ¶
Less returns tlv < lv. Returns an error (ErrOnlyTaintValueAcc) if lv is not a taint.Value.
func (Value) LessEqual ¶
LessEqual returns tlv <= lv. Returns an error (ErrOnlyTaintValueAcc) if lv is not a taint.Value.
func (Value) TopElement ¶
TopElement returns the highest element of the lattice.