Skip to content

Commit

Permalink
Merge branch 'master' into queries-ad-cont
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Sep 26, 2023
2 parents 2917999 + 5347c08 commit e718562
Show file tree
Hide file tree
Showing 42 changed files with 604 additions and 164 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,18 @@ jobs:
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # needed for GitHub Actions Cache in build-push-action
uses: docker/setup-buildx-action@v3 # needed for GitHub Actions Cache in build-push-action

- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
Expand All @@ -59,7 +59,7 @@ jobs:
- name: Build Docker image
id: build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
load: true # load into docker instead of immediately pushing
Expand All @@ -72,7 +72,7 @@ jobs:
run: docker run --rm -v $(pwd):/data ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.meta.outputs.version }} /data/tests/regression/04-mutex/01-simple_rc.c # run image by version in case multiple tags

- name: Push Docker image
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
push: true
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/unlocked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- ubuntu-latest
- macos-latest
ocaml-compiler:
- 5.0.x
- ocaml-variants.4.14.0+options,ocaml-option-flambda
- 4.14.x
- 4.13.x
Expand Down Expand Up @@ -211,11 +212,11 @@ jobs:
uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # needed for GitHub Actions Cache in build-push-action
uses: docker/setup-buildx-action@v3 # needed for GitHub Actions Cache in build-push-action

- name: Build dev Docker image
id: build
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
context: .
target: dev
Expand Down
14 changes: 7 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
## v2.2.0
* TODO OCaml 5 (#1003, #1137).
* TODO Library #1138
* TODO refactor race #1136
## v2.2.1
* Bump batteries lower bound to 3.5.0.
* Fix flaky dead code elimination transformation test.

## v2.2.0
* Add `setjmp`/`longjmp` analysis (#887, #970, #1015, #1019).
* Refactor race analysis to lazy distribution (#1084, #1089, #1016).
* Refactor race analysis to lazy distribution (#1084, #1089, #1136, #1016).
* Add thread-unsafe library function call analysis (#723, #1082).
* Add mutex type analysis and mutex API analysis (#800, #839, #1073).
* Add interval set domain and string literals domain (#901, #966, #994, #1048).
Expand All @@ -19,8 +19,8 @@
* Fix many incremental analysis issues (#627, #836, #835, #841, #932, #678, #942, #949, #950, #957, #955, #954, #960, #959, #1004, #558, #1010, #1091).
* Fix server mode for abstract debugging (#983, #990, #997, #1000, #1001, #1013, #1018, #1017, #1026, #1027).
* Add documentation for configuration JSON schema and OCaml API (#999, #1054, #1055, #1053).
* Add many library function specifications (#962, #996, #1028, #1079, #1121, #1135).
* Add OCaml 5.0 support (#945).
* Add many library function specifications (#962, #996, #1028, #1079, #1121, #1135, #1138).
* Add OCaml 5.0 support (#1003, #945, #1162).

## v2.1.0
Functionally equivalent to Goblint in SV-COMP 2023.
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Documentation can be browsed on [Read the Docs](https://goblint.readthedocs.io/e

## Installing
Both for using an up-to-date version of Goblint or developing it, the best way is to install from source by cloning this repository.
For benchmarking Goblint, please follow the [Benchmarking guide on Read the Docs](https://goblint.readthedocs.io/en/latest/user-guide/benchmarking/).

### Linux
1. Install [opam](https://opam.ocaml.org/doc/Install.html).
Expand Down
25 changes: 13 additions & 12 deletions docs/developer-guide/releasing.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,20 @@
10. Check that analysis works: `goblint -v tests/regression/04-mutex/01-simple_rc.c`.
11. Exit Docker container.

12. Create a GitHub release with the git tag: `DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish distrib`.
12. Temporarily enable Zenodo GitHub webhook.

This is because we only want numbered version releases to automatically add a new version to our Zenodo artifact.
Other tags (like SV-COMP or paper artifacts) have manually created Zenodo artifacts anyway and thus shouldn't add new versions to the main Zenodo artifact.

13. Create a GitHub release with the git tag: `DUNE_RELEASE_DELEGATE=github-dune-release-delegate dune-release publish distrib`.

Explicitly specify `distrib` because we don't want to publish OCaml API docs.
Environment variable workaround for the package having a Read the Docs `doc` URL (see <https://github.com/ocamllabs/dune-release/issues/154>).

13. Create an opam package: `dune-release opam pkg`.
14. Submit the opam package to opam-repository: `dune-release opam submit`.
14. Re-disable Zenodo GitHub webhook.

15. Create an opam package: `dune-release opam pkg`.
16. Submit the opam package to opam-repository: `dune-release opam submit`.


## SV-COMP
Expand Down Expand Up @@ -104,15 +111,9 @@
### After all preruns

1. Push git tag from last prerun: `git push origin svcompXY`.
2. Temporarily disable Zenodo webhook.

This is because we don't want a new out-of-place version of Goblint in our Zenodo artifact.
A separate Zenodo artifact for the SV-COMP version can be created later if tool paper is submitted.

3. Create GitHub release from the git tag and attach latest submitted archive as a download.
4. Manually run `docker` workflow on `svcompXY` git tag and targeting `svcompXY` Docker tag.
2. Create GitHub release from the git tag and attach latest submitted archive as a download.
3. Manually run `docker` workflow on `svcompXY` git tag and targeting `svcompXY` Docker tag.

This is because the usual `docker` workflow only handles semver releases.

5. Re-enable Zenodo webhook.
6. Release new semver version on opam. See above.
4. Release new semver version on opam. See above.
27 changes: 26 additions & 1 deletion docs/user-guide/benchmarking.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
# Benchmarking
The following best practices should be followed when benchmarking Goblint.
This is to ensure valid, reproducible and representative benchmarking results.

To achieve reproducible builds and the best performance for benchmarking, it is recommended to compile Goblint using the `release` option:
# External benchmarking
External users should choose the version of Goblint to evaluate or benchmark as follows:

1. Use the newest version release.

The version from git `master` branch or any other intermediate git commit come without any guarantees.
They are bleeding-edge and haven't gone through validation like the version releases.

SV-COMP releases are highly preferable since they've gone through rigorous validation in SV-COMP.

2. Download the corresponding version from a Zenodo artifact or by checking out the respective git tag. **Do not install directly from opam repository!**

Goblint pins optimized versions of some dependencies which cannot be done on the opam repository releases.
Thus, using the latter would yield unrepresentative results.

Zenodo artifacts come with DOIs, which make them ideal for citation.

3. Use OCaml 4.14. **Do not use OCaml 5!**

OCaml 5 has significant performance regressions, which yield unrepresentative benchmarking results.
Goblint's `make setup` installs the correct OCaml version into a new opam switch.

# Release build
To achieve the best performance for benchmarking, Goblint should be compiled using the `release` option:

```sh
make release
Expand Down
4 changes: 2 additions & 2 deletions dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
(synopsis "Static analysis framework for C")
(depends
(ocaml (>= 4.10))
(goblint-cil (>= 2.0.1)) ; TODO no way to define as pin-depends? Used goblint.opam.template to add it for now. https://github.com/ocaml/dune/issues/3231. Alternatively, removing this line and adding cil as a git submodule and `(vendored_dirs cil)` as ./dune also works. This way, no more need to reinstall the pinned cil opam package on changes. However, then cil is cleaned and has to be rebuild together with goblint.
(batteries (>= 3.4.0))
(goblint-cil (>= 2.0.2)) ; TODO no way to define as pin-depends? Used goblint.opam.template to add it for now. https://github.com/ocaml/dune/issues/3231. Alternatively, removing this line and adding cil as a git submodule and `(vendored_dirs cil)` as ./dune also works. This way, no more need to reinstall the pinned cil opam package on changes. However, then cil is cleaned and has to be rebuild together with goblint.
(batteries (>= 3.5.0))
(zarith (>= 1.8))
(yojson (>= 2.0.0))
(qcheck-core (>= 0.19))
Expand Down
16 changes: 9 additions & 7 deletions goblint.opam
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ bug-reports: "https://github.com/goblint/analyzer/issues"
depends: [
"dune" {>= "3.6"}
"ocaml" {>= "4.10"}
"goblint-cil" {>= "2.0.1"}
"batteries" {>= "3.4.0"}
"goblint-cil" {>= "2.0.2"}
"batteries" {>= "3.5.0"}
"zarith" {>= "1.8"}
"yojson" {>= "2.0.0"}
"qcheck-core" {>= "0.19"}
Expand Down Expand Up @@ -74,10 +74,12 @@ dev-repo: "git+https://github.com/goblint/analyzer.git"
# on `dune build` goblint.opam will be generated from goblint.opam.template and dune-project
# also remember to generate/adjust goblint.opam.locked!
available: os-distribution != "alpine" & arch != "arm64"
pin-depends: [
[ "goblint-cil.2.0.1" "git+https://github.com/goblint/cil.git#4df989fe625d91ce07d94afe1d85b3b5c6cdd63e" ]
# pin-depends: [
# published goblint-cil 2.0.2 is currently up-to-date, so no pin needed
# [ "goblint-cil.2.0.2" "git+https://github.com/goblint/cil.git#98598d94f796a63751e5a9d39c6b3a9fe1f32330" ]
# TODO: add back after release, only pinned for optimization (https://github.com/ocaml-ppx/ppx_deriving/pull/252)
[ "ppx_deriving.5.2.1" "git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6" ]
# TODO: add back after release, only pinned for CI stability
[ "apron.v0.9.13" "git+https://github.com/antoinemine/apron.git#1a8e91062c0d7d1e80333d19d5a432332bbbaec8"]
# [ "ppx_deriving.5.2.1" "git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6" ]
# ]
post-messages: [
"Do not benchmark Goblint on OCaml 5 (https://goblint.readthedocs.io/en/latest/user-guide/benchmarking/)." {ocaml:version >= "5.0.0"}
]
26 changes: 7 additions & 19 deletions goblint.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ doc: "https://goblint.readthedocs.io/en/latest/"
bug-reports: "https://github.com/goblint/analyzer/issues"
depends: [
"angstrom" {= "0.15.0"}
"apron" {= "v0.9.13"}
"apron" {= "v0.9.14~beta.2"}
"arg-complete" {= "0.1.0"}
"astring" {= "0.8.5"}
"base-bigarray" {= "base"}
Expand Down Expand Up @@ -56,22 +56,22 @@ depends: [
"dune-private-libs" {= "3.6.1"}
"dune-site" {= "3.6.1"}
"dyn" {= "3.6.1"}
"fileutils" {= "0.6.4"}
"fmt" {= "0.9.0"}
"fpath" {= "0.7.3"}
"goblint-cil" {= "2.0.1"}
"goblint-cil" {= "2.0.2"}
"integers" {= "0.7.0"}
"json-data-encoding" {= "0.12.1"}
"jsonrpc" {= "1.15.0~5.0preview1"}
"fileutils" {= "0.6.4"}
"logs" {= "0.7.0"}
"mlgmpidl" {= "1.2.14"}
"mlgmpidl" {= "1.2.15"}
"num" {= "1.4"}
"ocaml" {= "4.14.0"}
"ocaml-variants" {= "4.14.0+options"}
"ocaml-compiler-libs" {= "v0.12.4"}
"ocaml-config" {= "2"}
"ocaml-option-flambda" {= "1"}
"ocaml-syntax-shims" {= "1.0.0"}
"ocaml-variants" {= "4.14.0+options"}
"ocamlbuild" {= "0.14.2"}
"ocamlfind" {= "1.9.5"}
"odoc" {= "2.2.0" & with-doc}
Expand Down Expand Up @@ -125,18 +125,6 @@ available: os-distribution != "alpine" & arch != "arm64"
conflicts: [
"result" {< "1.5"}
]
# TODO: manually reordered to avoid opam pin crash: https://github.com/ocaml/opam/issues/4936
pin-depends: [
[
"goblint-cil.2.0.1"
"git+https://github.com/goblint/cil.git#4df989fe625d91ce07d94afe1d85b3b5c6cdd63e"
]
[
"apron.v0.9.13"
"git+https://github.com/antoinemine/apron.git#1a8e91062c0d7d1e80333d19d5a432332bbbaec8"
]
[
"ppx_deriving.5.2.1"
"git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6"
]
post-messages: [
"Do not benchmark Goblint on OCaml 5 (https://goblint.readthedocs.io/en/latest/user-guide/benchmarking/)." {ocaml:version >= "5.0.0"}
]
12 changes: 7 additions & 5 deletions goblint.opam.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# on `dune build` goblint.opam will be generated from goblint.opam.template and dune-project
# also remember to generate/adjust goblint.opam.locked!
available: os-distribution != "alpine" & arch != "arm64"
pin-depends: [
[ "goblint-cil.2.0.1" "git+https://github.com/goblint/cil.git#4df989fe625d91ce07d94afe1d85b3b5c6cdd63e" ]
# pin-depends: [
# published goblint-cil 2.0.2 is currently up-to-date, so no pin needed
# [ "goblint-cil.2.0.2" "git+https://github.com/goblint/cil.git#98598d94f796a63751e5a9d39c6b3a9fe1f32330" ]
# TODO: add back after release, only pinned for optimization (https://github.com/ocaml-ppx/ppx_deriving/pull/252)
[ "ppx_deriving.5.2.1" "git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6" ]
# TODO: add back after release, only pinned for CI stability
[ "apron.v0.9.13" "git+https://github.com/antoinemine/apron.git#1a8e91062c0d7d1e80333d19d5a432332bbbaec8"]
# [ "ppx_deriving.5.2.1" "git+https://github.com/ocaml-ppx/ppx_deriving.git#0a89b619f94cbbfc3b0fb3255ab4fe5bc77d32d6" ]
# ]
post-messages: [
"Do not benchmark Goblint on OCaml 5 (https://goblint.readthedocs.io/en/latest/user-guide/benchmarking/)." {ocaml:version >= "5.0.0"}
]
2 changes: 1 addition & 1 deletion gobview
2 changes: 1 addition & 1 deletion make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ opam_setup() {
set -x
opam init -y -a --bare $SANDBOXING # sandboxing is disabled in travis and docker
opam update
opam switch -y create . --deps-only ocaml-variants.4.14.0+options ocaml-option-flambda --locked
opam switch -y create . --deps-only --packages=ocaml-variants.4.14.0+options,ocaml-option-flambda --locked
}

rule() {
Expand Down
10 changes: 5 additions & 5 deletions src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1099,12 +1099,12 @@ struct

let eval_funvar ctx fval: Queries.AD.t =
let fp = eval_fv (Analyses.ask_of_ctx ctx) ctx.global ctx.local fval in
if AD.is_top fp then begin
if AD.is_top fp then (
if AD.cardinal fp = 1 then
(M.warn ~category:Unsound "Unknown call to function %a." d_exp fval;)
M.warn ~category:Imprecise ~tags:[Category Call] "Unknown call to function %a." d_exp fval
else
(M.warn ~category:Imprecise "Function pointer %a may contain unknown functions." d_exp fval;)
end;
M.warn ~category:Imprecise ~tags:[Category Call] "Function pointer %a may contain unknown functions." d_exp fval
);
fp

(** Evaluate expression as address.
Expand Down Expand Up @@ -1962,7 +1962,7 @@ struct
end

let special_unknown_invalidate ctx ask gs st f args =
(if CilType.Varinfo.equal f dummyFunDec.svar then M.warn ~category:Imprecise "Unknown function ptr called");
(if CilType.Varinfo.equal f dummyFunDec.svar then M.warn ~category:Imprecise ~tags:[Category Call] "Unknown function ptr called");
let desc = LF.find f in
let shallow_addrs = LibraryDesc.Accesses.find desc.accs { kind = Write; deep = false } args in
let deep_addrs = LibraryDesc.Accesses.find desc.accs { kind = Write; deep = true } args in
Expand Down
26 changes: 19 additions & 7 deletions src/analyses/baseInvariant.ml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,18 @@ struct
meet_bin c c
else
a, b
| BAnd as op ->
(* we only attempt to refine a here *)
let a =
match ID.to_int b with
| Some x when BI.equal x BI.one ->
(match ID.to_bool c with
| Some true -> ID.meet a (ID.of_congruence ikind (Z.one, Z.of_int 2))
| Some false -> ID.meet a (ID.of_congruence ikind (Z.zero, Z.of_int 2))
| None -> if M.tracing then M.tracel "inv" "Unhandled case for operator x %a 1 = %a\n" d_binop op ID.pretty c; a)
| _ -> if M.tracing then M.tracel "inv" "Unhandled case for operator x %a %a = %a\n" d_binop op ID.pretty b ID.pretty c; a
in
a, b
| op ->
if M.tracing then M.tracel "inv" "Unhandled operator %a\n" d_binop op;
a, b
Expand Down Expand Up @@ -545,8 +557,8 @@ struct
in
let eval e st = eval_rv a gs st e in
let eval_bool e st = match eval e st with Int i -> ID.to_bool i | _ -> None in
let unroll_fk_of_exp e =
match unrollType (Cilfacade.typeOf e) with
let unroll_fk_of_exp e =
match unrollType (Cilfacade.typeOf e) with
| TFloat (fk, _) -> fk
| _ -> failwith "value which was expected to be a float is of different type?!"
in
Expand Down Expand Up @@ -700,8 +712,8 @@ struct
begin match t with
| TInt (ik, _) ->
begin match x with
| ((Var v), offs) ->
if M.tracing then M.trace "invSpecial" "qry Result: %a\n" Queries.ML.pretty (ctx.ask (Queries.TmpSpecial (v, Offset.Exp.of_cil offs)));
| ((Var v), offs) ->
if M.tracing then M.trace "invSpecial" "qry Result: %a\n" Queries.ML.pretty (ctx.ask (Queries.TmpSpecial (v, Offset.Exp.of_cil offs)));
let tv_opt = ID.to_bool c in
begin match tv_opt with
| Some tv ->
Expand Down Expand Up @@ -735,12 +747,12 @@ struct
begin match t with
| TFloat (fk, _) ->
begin match x with
| ((Var v), offs) ->
if M.tracing then M.trace "invSpecial" "qry Result: %a\n" Queries.ML.pretty (ctx.ask (Queries.TmpSpecial (v, Offset.Exp.of_cil offs)));
| ((Var v), offs) ->
if M.tracing then M.trace "invSpecial" "qry Result: %a\n" Queries.ML.pretty (ctx.ask (Queries.TmpSpecial (v, Offset.Exp.of_cil offs)));
begin match ctx.ask (Queries.TmpSpecial (v, Offset.Exp.of_cil offs)) with
| `Lifted (Ceil (ret_fk, xFloat)) -> inv_exp (Float (FD.inv_ceil (FD.cast_to ret_fk c))) xFloat st
| `Lifted (Floor (ret_fk, xFloat)) -> inv_exp (Float (FD.inv_floor (FD.cast_to ret_fk c))) xFloat st
| `Lifted (Fabs (ret_fk, xFloat)) ->
| `Lifted (Fabs (ret_fk, xFloat)) ->
let inv = FD.inv_fabs (FD.cast_to ret_fk c) in
if FD.is_bot inv then
raise Analyses.Deadcode
Expand Down
Loading

0 comments on commit e718562

Please sign in to comment.