interesting

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 13, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package interesting contains tools for our static analysis to determine whether a leaf function is interesting.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Classifier

type Classifier struct {
	// contains filtered or unexported fields
}

Type Classifier contains informatation used to map code features to concrete capabilities.

func ClassifierExcludingUnanalyzed added in v0.2.0

func ClassifierExcludingUnanalyzed(classifier *Classifier) *Classifier

ClassifierExcludingUnanalyzed returns a copy of the supplied Classifier that is modified to never classify capabilities as CAPABILITY_UNANALYZED.

func DefaultClassifier

func DefaultClassifier() *Classifier

DefaultClassifier returns the default internal Classifier.

func LoadClassifier added in v0.2.0

func LoadClassifier(source string, r io.Reader, excludeBuiltin bool) (*Classifier, error)

LoadClassifier returns a capability classifier loaded from the specified io.Reader. The filename argument is used only for providing context to error messages. The classifier will also include the default Capslock classifications unless the excludeBuiltin argument is set.

Refer to the interesting/interesting.cm file in the source code for an example of the capability map format. Classifications loaded from a caller-specified file always override builtin classifications.

func (*Classifier) FunctionCategory

func (c *Classifier) FunctionCategory(pkg, name string) cpb.Capability

FunctionCategory returns a Category for the given function specified by a package name and function name. Examples of function names include "math.Cos", "(time.Time).Clock", and "(*sync.Cond).Signal".

If the return value is Unspecified, then we have not declared it to be either safe or unsafe, so its descendants will have to be considered by the static analysis.

func (*Classifier) IncludeCall

func (c *Classifier) IncludeCall(caller, callee string) bool

IncludeCall returns true if a call from one function to another should be considered when searching for transitive capabilities. We return false for some internal calls in the standard library where we know a potential transitive capability does not arise in practice.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL