ar-go-tools

module
v0.3.5-alpha Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0

README

build-analyze-test License

Argot

Overview

Argot is a collection of static analysis tools:

  • taint performs a taint analysis on a given program
  • backtrace identifies backwards data-flow traces from function calls
  • cli is an interactive terminal-like interface for parts of the analysis (in cmd/cli)
  • syntactic runs syntactic analyses
  • compare prints a comparison of the functions that are reachable according to two different analyses, and the functions that appear in the binary
  • dependencies prints the dependencies of a given program
  • maypanic performs a may-panic analysis on a given program
  • packagescan scans imports in packages
  • reachability analyzes the program an prints the functions that are reachable within it
  • render can be used to render a graph representation of the callgraph, or to print the SSA form from the go analysis package
  • ssa-statistics prints statistics about the program

All of these tools are sub-commands of the argot command.

Building the tools

The Makefile at the project root has commands to build Argot.

Run make argot-build to only compile the argot binary.

Run make argot-install to install argot via the go install command.

Run make release to run all the linters and tests.

Running the tools

For a more detailed guide on how to run and use the tools, see the 00_intro.md document. There are links to documents for each of the tools listed above, as well as an explanation on how to configure those tools that have shared options.

Source Code Organization

The executables are in the cmd folder. There are currently only two: argot and racerg (an experimental static data race detector).

There is user documentation in the doc folder.

The library code, and most of the analysis implementations, is in the analysis folder. The main entry points are in the load_program.go file for loading the program and analyzers.go to call the analyzers. The rest is organized in subfolders:

  • astfuncs contains functions for manipulating the Go AST,
  • backtrace implements the "backtrace" analysis,
  • concurrency contains the concurrency analyses,
  • config implements the config file system that is shared by all analyses,
  • dataflow implements the dataflow analysis as well as the analysis state object, which is shared by many analyses. Static analyses that require pointer and callgraph information should depend on the dataflow analysis state and use its functionality to build information about the SSA program.
  • defers contains the defers analysis,
  • dependencies contains the dependencies analysis,
  • lang contains function for manipulating the Go SSA form (from the x/tools packages),
  • loadprogram contains utilities to load a program with its SSA representation and the annotations of the program,
  • maypanic contains the may-panic analysis,
  • ptr contains utilities to build an analysis state with the pointer analysis result,
  • reachability contains function-reachability analyses,
  • refactor contains implements refactoring operations,
  • render contains various information rendering utilities
  • summaries defines dataflow summaries of some functions,
  • taint implements the taint analysis

The test data for the analyses are in individual analysis/___/testdata folders.

The internal folder also contains code that implements utility functions used through the analysis code.

Directories

Path Synopsis
backtrace
Package backtrace defines a dataflow analysis that finds all the backwards dataflow paths from an entrypoint.
Package backtrace defines a dataflow analysis that finds all the backwards dataflow paths from an entrypoint.
config
Package config provides a simple way to manage configuration files.
Package config provides a simple way to manage configuration files.
dataflow
Package dataflow implements the core of the dataflow analysis.
Package dataflow implements the core of the dataflow analysis.
defers
Package defers implements an analysis that determines which set of defer instructions can reach each program point.
Package defers implements an analysis that determines which set of defer instructions can reach each program point.
escape
Package escape provides an escape analysis which computes a representation of which references in the program are to objects that are local to the current function and goroutine.
Package escape provides an escape analysis which computes a representation of which references in the program are to objects that are local to the current function and goroutine.
lang
Package lang contains functions to help manipulate different objects representing elements of the Go language and the ssa.
Package lang contains functions to help manipulate different objects representing elements of the Go language and the ssa.
ptr
render
Package render provides functions to build a inter-procedural dataflow graph.
Package render provides functions to build a inter-procedural dataflow graph.
summaries
Package summaries defines how data flow information can be summarized for a given function.
Package summaries defines how data flow information can be summarized for a given function.
syntactic
Package syntactic contains syntactic analyses.
Package syntactic contains syntactic analyses.
syntactic/structinit
Package structinit implements the struct initialization syntactic analysis.
Package structinit implements the struct initialization syntactic analysis.
taint
Package taint implements most of the taint analysis functionality.
Package taint implements most of the taint analysis functionality.
cmd
argot/backtrace
Package backtrace implements the front-end to the backtrace analysis.
Package backtrace implements the front-end to the backtrace analysis.
argot/cli
Package cli implements the interactive argot CLI.
Package cli implements the interactive argot CLI.
argot/compare
Package compare implements the compare tool.
Package compare implements the compare tool.
argot/defers
Package defers implements the frontend to the analysis to detect unbounded defers.
Package defers implements the frontend to the analysis to detect unbounded defers.
argot/dependencies
Package dependencies implements the frontend to the dependencies analysis.
Package dependencies implements the frontend to the dependencies analysis.
argot/maypanic
Package maypanic implements the front-end to the maypanic anaylsis.
Package maypanic implements the front-end to the maypanic anaylsis.
argot/packagescan
Package packagescan implements the front-end to the packagescan analysis.
Package packagescan implements the front-end to the packagescan analysis.
argot/render
Package render implements a tool for rendering various "visualizations" of Go programs.
Package render implements a tool for rendering various "visualizations" of Go programs.
argot/statistics
Package statistics implements the front-end for the SSA statistics analysis.
Package statistics implements the front-end for the SSA statistics analysis.
argot/syntactic
Package syntactic implements the front-end to the Argot syntactic tool which runs different syntactic checks on your code.
Package syntactic implements the front-end to the Argot syntactic tool which runs different syntactic checks on your code.
argot/taint
Package taint implements the front-end to the Argot taint tool which runs taint analysis on your code, using its SSA representation.
Package taint implements the front-end to the Argot taint tool which runs taint analysis on your code, using its SSA representation.
argot/tools
Package tools contains utility types and functions for Argot tool frontends.
Package tools contains utility types and functions for Argot tool frontends.
racerg
Souffle-based static race detector for Go.
Souffle-based static race detector for Go.
internal
analysistest
Package analysistest contains utility functions for testing the analysis tools.
Package analysistest contains utility functions for testing the analysis tools.
analysisutil
Package analysisutil contains utility functions for the analyses in argot.
Package analysisutil contains utility functions for the analyses in argot.
formatutil
Package formatutil manipulates string colors and other formatting operations.
Package formatutil manipulates string colors and other formatting operations.
funcutil
Package funcutil is an internal package providing utility functions to enable functional programming idioms in Go.
Package funcutil is an internal package providing utility functions to enable functional programming idioms in Go.
graphutil
Package graphutil contains utility functions for manipulating graphs.
Package graphutil contains utility functions for manipulating graphs.
pointer
Package pointer implements Andersen's analysis, an inclusion-based pointer analysis algorithm first described in (Andersen, 1994).
Package pointer implements Andersen's analysis, an inclusion-based pointer analysis algorithm first described in (Andersen, 1994).
shims
Package shims provides functions that are in "future" releases of the Go standard library.
Package shims provides functions that are in "future" releases of the Go standard library.
typeparams
Package typeparams contains common utilities for writing tools that interact with generic Go code, as introduced with Go 1.18.
Package typeparams contains common utilities for writing tools that interact with generic Go code, as introduced with Go 1.18.

Jump to

Keyboard shortcuts

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