Skip to content

Commit

Permalink
tools/syz-db: add more usage info for syz-db
Browse files Browse the repository at this point in the history
Add some short notes on how syz-db can also be used manually.

Signed-off-by: Simone Weiß <[email protected]>
  • Loading branch information
simone-weiss authored and dvyukov committed Apr 22, 2024
1 parent af24b05 commit 36c961a
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 5 deletions.
59 changes: 59 additions & 0 deletions docs/db.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# syz-db

`syz-db` program can be used to manipulate corpus.db databases that are used
by syz-managers.

## Build

Build `syz-db` with `make db` or by changing to `tools/syz-db` and run `go build`.

## Options

`syz-db` currently overs the following generic arguments:

```shell
-arch string
target arch
-os string
target OS
-version uint
database version
-vv int
verbosity
```

That can be used with

```
syz-db pack dir corpus.db
```

to pack a database

```
syz-db unpack corpus.db dir
```

to unpack a database. A file containing performed syscalls will be returned.

```
syz-db merge dst-corpus.db add-corpus.db* add-prog*
```

to merge databases. No additional file will be created: The first file will be replaced by the merged result.

```
syz-db bench corpus.db
```

to run a deserialization benchmark. For example:

```
syz-db -os=linux -arch=amd64 bench corpus.db
```

could give an output like

```
allocs 123 MB (123 M), next GC 123 MB, sys heap 123 MB, live allocs 123 MB (123 M), time 324s.
```
23 changes: 18 additions & 5 deletions tools/syz-db/syz-db.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,24 @@ func main() {
}

func usage() {
fmt.Fprintf(os.Stderr, "usage:\n")
fmt.Fprintf(os.Stderr, " syz-db pack dir corpus.db\n")
fmt.Fprintf(os.Stderr, " syz-db unpack corpus.db dir\n")
fmt.Fprintf(os.Stderr, " syz-db merge dst-corpus.db add-corpus.db* add-prog*\n")
fmt.Fprintf(os.Stderr, " syz-db bench corpus.db\n")
fmt.Fprintf(os.Stderr, `usage: syz-db can be used to manipulate corpus
databases that are used by syz-managers. The following generic arguments are
offered:
-arch string
-os string
-version uint
-vv int
they can be used for:
packing a database:
syz-db pack dir corpus.db
unpacking a database. A file containing performed syscalls will be returned:
syz-db unpack corpus.db dir
merging databases. No additional file will be created: The first file will be replaced by the merged result:
syz-db merge dst-corpus.db add-corpus.db* add-prog*
running a deserialization benchmark:
syz-db bench corpus.db
`)
os.Exit(1)
}

Expand Down

0 comments on commit 36c961a

Please sign in to comment.