Skip to content

Commit

Permalink
Merge branch 'master' into apron-compare-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Jul 8, 2024
2 parents 71a1657 + 502cf9f commit 852a453
Show file tree
Hide file tree
Showing 58 changed files with 1,041 additions and 351 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ jobs:
# otherwise setup-ocaml pins non-locked dependencies
# https://github.com/ocaml/setup-ocaml/issues/166
OPAMLOCKED: locked
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test # doesn't work (https://github.com/ocaml/opam/issues/5836)

- name: Install graph-easy # TODO: remove if depext --with-test works
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
- name: Build Docker image
id: build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
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@v5
uses: docker/build-push-action@v6
with:
context: .
push: true
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
# otherwise setup-ocaml pins non-locked dependencies
# https://github.com/ocaml/setup-ocaml/issues/166
OPAMLOCKED: locked
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/indentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
fetch-depth: 0

- name: Set up OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/locked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
# otherwise setup-ocaml pins non-locked dependencies
# https://github.com/ocaml/setup-ocaml/issues/166
OPAMLOCKED: locked
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test # doesn't work (https://github.com/ocaml/opam/issues/5836)

- name: Install graph-easy # TODO: remove if depext --with-test works
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down Expand Up @@ -87,10 +86,9 @@ jobs:
# otherwise setup-ocaml pins non-locked dependencies
# https://github.com/ocaml/setup-ocaml/issues/166
OPAMLOCKED: locked
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test # doesn't work (https://github.com/ocaml/opam/issues/5836)

- name: Install graph-easy # TODO: remove if depext --with-test works
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down Expand Up @@ -132,7 +130,7 @@ jobs:
# otherwise setup-ocaml pins non-locked dependencies
# https://github.com/ocaml/setup-ocaml/issues/166
OPAMLOCKED: locked
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}

Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/unlocked.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,9 @@ jobs:
uses: actions/checkout@v4

- name: Set up OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test # doesn't work (https://github.com/ocaml/opam/issues/5836)

- name: Install graph-easy # TODO: remove if depext --with-test works
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down Expand Up @@ -109,7 +108,6 @@ jobs:
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test # doesn't work (https://github.com/ocaml/opam/issues/5836)

- name: Install graph-easy # TODO: remove if depext --with-test works
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down Expand Up @@ -165,7 +163,7 @@ jobs:

- name: Build dev Docker image
id: build
uses: docker/build-push-action@v5
uses: docker/build-push-action@v6
with:
context: .
target: dev
Expand Down Expand Up @@ -199,10 +197,9 @@ jobs:
uses: actions/checkout@v4

- name: Set up OCaml ${{ matrix.ocaml-compiler }}
uses: ocaml/setup-ocaml@v2
uses: ocaml/setup-ocaml@v3
with:
ocaml-compiler: ${{ matrix.ocaml-compiler }}
opam-depext-flags: --with-test # doesn't work (https://github.com/ocaml/opam/issues/5836)

- name: Install graph-easy # TODO: remove if depext --with-test works
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand Down
5 changes: 5 additions & 0 deletions .zenodo.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@
"affiliation": "Technische Universität München",
"orcid": "0009-0009-9644-7475"
},
{
"name": "Holter, Karoliine",
"affiliation": "University of Tartu",
"orcid": "0009-0008-3725-4131"
},
{
"name": "Vogler, Ralf",
"affiliation": "Technische Universität München"
Expand Down
4 changes: 4 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ authors: # same authors as in .zenodo.json and dune-project
family-names: Tilscher
affiliation: "Technische Universität München"
orcid: "https://orcid.org/0009-0009-9644-7475"
- given-names: Karoliine
family-names: Holter
affiliation: "University of Tartu"
orcid: "https://orcid.org/0009-0008-3725-4131"
- given-names: Ralf
family-names: Vogler
affiliation: "Technische Universität München"
Expand Down
2 changes: 2 additions & 0 deletions conf/examples/medium-program.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"base",
"threadid",
"threadflag",
"threadreturn",
"mallocWrapper",
"mutexEvents",
"mutex",
Expand All @@ -18,6 +19,7 @@
"expRelation",
"mhp",
"assert",
"pthreadMutexType",
"var_eq",
"symb_locks",
"region",
Expand Down
2 changes: 2 additions & 0 deletions conf/examples/very-precise.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"base",
"threadid",
"threadflag",
"threadreturn",
"mallocWrapper",
"mutexEvents",
"mutex",
Expand All @@ -31,6 +32,7 @@
"expRelation",
"mhp",
"assert",
"pthreadMutexType",
"var_eq",
"symb_locks",
"region",
Expand Down
19 changes: 19 additions & 0 deletions docs/user-guide/assumptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,22 @@ _NB! This list is likely incomplete._

See [PR #1414](https://github.com/goblint/analyzer/pull/1414).

2. Pointer arithmetic does not overflow.

[C11's N1570][n1570] at 6.5.6.8 states that

> When an expression that has integer type is added to or subtracted from a pointer, the result has the type of the pointer operand.
> [...]
> the evaluation shall not produce an overflow; otherwise, the behavior is undefined.
after a long list of defined behaviors.

Goblint does not report overflow and out-of-bounds pointer arithmetic (when the pointer _is not dereferenced_).
This affects the overflow analysis (SV-COMP no-overflow property) in the `base` analysis.

This _does not_ affect the `memOutOfBounds` analysis (SV-COMP valid-memsafety property), which is for undefined behavior from _dereferencing_ such out-of-bounds pointers.

See [PR #1511](https://github.com/goblint/analyzer/pull/1511).


[n1570]: https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1570.pdf
15 changes: 14 additions & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,26 @@
(source (github goblint/analyzer))
(homepage "https://goblint.in.tum.de")
(documentation "https://goblint.readthedocs.io/en/latest/")
(authors "Simmo Saan" "Michael Schwarz" "Julian Erhard" "Sarah Tilscher" "Ralf Vogler" "Kalmer Apinis" "Vesal Vojdani" ) ; same authors as in .zenodo.json and CITATION.cff
(authors "Simmo Saan" "Michael Schwarz" "Julian Erhard" "Sarah Tilscher" "Karoliine Holter" "Ralf Vogler" "Kalmer Apinis" "Vesal Vojdani" ) ; same authors as in .zenodo.json and CITATION.cff
(maintainers "Simmo Saan <[email protected]>" "Michael Schwarz <[email protected]>" "Karoliine Holter")
(license MIT)

(package
(name goblint)
(synopsis "Static analysis framework for C")
(description "\
Goblint is a sound static analysis framework for C programs using abstract interpretation.
It specializes in thread-modular verification of multi-threaded programs, especially regarding data races.
Goblint includes analyses for assertions, overflows, deadlocks, etc and can be extended with new analyses.
")
(tags (
"program analysis"
"program verification"
"static analysis"
"abstract interpretation"
"C"
"data race analysis"
"concurrency"))
(depends
(ocaml (>= 4.14))
(goblint-cil (>= 2.0.3)) ; 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.
Expand Down
15 changes: 15 additions & 0 deletions goblint.opam
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# This file is generated by dune, edit dune-project instead
opam-version: "2.0"
synopsis: "Static analysis framework for C"
description: """
Goblint is a sound static analysis framework for C programs using abstract interpretation.
It specializes in thread-modular verification of multi-threaded programs, especially regarding data races.
Goblint includes analyses for assertions, overflows, deadlocks, etc and can be extended with new analyses.
"""
maintainer: [
"Simmo Saan <[email protected]>"
"Michael Schwarz <[email protected]>"
Expand All @@ -11,11 +16,21 @@ authors: [
"Michael Schwarz"
"Julian Erhard"
"Sarah Tilscher"
"Karoliine Holter"
"Ralf Vogler"
"Kalmer Apinis"
"Vesal Vojdani"
]
license: "MIT"
tags: [
"program analysis"
"program verification"
"static analysis"
"abstract interpretation"
"C"
"data race analysis"
"concurrency"
]
homepage: "https://goblint.in.tum.de"
doc: "https://goblint.readthedocs.io/en/latest/"
bug-reports: "https://github.com/goblint/analyzer/issues"
Expand Down
14 changes: 14 additions & 0 deletions goblint.opam.locked
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ authors: [
"Michael Schwarz"
"Julian Erhard"
"Sarah Tilscher"
"Karoliine Holter"
"Ralf Vogler"
"Kalmer Apinis"
"Vesal Vojdani"
Expand Down Expand Up @@ -142,3 +143,16 @@ pin-depends: [
]
]
depexts: ["libgraph-easy-perl"] {os-distribution = "ubuntu" & with-test}
description: """\
Goblint is a sound static analysis framework for C programs using abstract interpretation.
It specializes in thread-modular verification of multi-threaded programs, especially regarding data races.
Goblint includes analyses for assertions, overflows, deadlocks, etc and can be extended with new analyses."""
tags: [
"program analysis"
"program verification"
"static analysis"
"abstract interpretation"
"C"
"data race analysis"
"concurrency"
]
18 changes: 9 additions & 9 deletions src/analyses/apron/relationAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,11 @@ struct
let st = ctx.local in
let reachable_from_args = reachable_from_args ctx args in
let fundec = Node.find_fundec ctx.node in
if M.tracing then M.tracel "combine" "relation f: %a" CilType.Varinfo.pretty f.svar;
if M.tracing then M.tracel "combine" "relation formals: %a" (d_list "," CilType.Varinfo.pretty) f.sformals;
if M.tracing then M.tracel "combine" "relation args: %a" (d_list "," d_exp) args;
if M.tracing then M.tracel "combine" "relation st: %a" D.pretty st;
if M.tracing then M.tracel "combine" "relation fun_st: %a" D.pretty fun_st;
if M.tracing then M.tracel "combine-rel" "relation f: %a" CilType.Varinfo.pretty f.svar;
if M.tracing then M.tracel "combine-rel" "relation formals: %a" (d_list "," CilType.Varinfo.pretty) f.sformals;
if M.tracing then M.tracel "combine-rel" "relation args: %a" (d_list "," d_exp) args;
if M.tracing then M.tracel "combine-rel" "relation st: %a" D.pretty st;
if M.tracing then M.tracel "combine-rel" "relation fun_st: %a" D.pretty fun_st;
let new_fun_rel = RD.add_vars fun_st.rel (RD.vars st.rel) in
let arg_substitutes =
let filter_actuals (x,e) =
Expand All @@ -418,7 +418,7 @@ struct
in
let any_local_reachable = any_local_reachable fundec reachable_from_args in
let arg_vars = f.sformals |> List.filter (RD.Tracked.varinfo_tracked) |> List.map RV.arg in
if M.tracing then M.tracel "combine" "relation remove vars: %a" (docList (fun v -> Pretty.text (Apron.Var.to_string v))) arg_vars;
if M.tracing then M.tracel "combine-rel" "relation remove vars: %a" (docList (fun v -> Pretty.text (Apron.Var.to_string v))) arg_vars;
RD.remove_vars_with new_fun_rel arg_vars; (* fine to remove arg vars that also exist in caller because unify from new_rel adds them back with proper constraints *)
let tainted = f_ask.f Queries.MayBeTainted in
let tainted_vars = TaintPartialContexts.conv_varset tainted in
Expand All @@ -432,7 +432,7 @@ struct
)
in
let unify_rel = RD.unify new_rel new_fun_rel in (* TODO: unify_with *)
if M.tracing then M.tracel "combine" "relation unifying %a %a = %a" RD.pretty new_rel RD.pretty new_fun_rel RD.pretty unify_rel;
if M.tracing then M.tracel "combine-rel" "relation unifying %a %a = %a" RD.pretty new_rel RD.pretty new_fun_rel RD.pretty unify_rel;
{fun_st with rel = unify_rel}

let combine_assign ctx r fe f args fc fun_st (f_ask : Queries.ask) =
Expand Down Expand Up @@ -756,7 +756,7 @@ struct

let sync ctx reason =
(* After the solver is finished, store the results (for later comparison) *)
if !AnalysisState.postsolving then begin
if !AnalysisState.postsolving && GobConfig.get_string "exp.relation.prec-dump" <> "" then begin
let keep_local = GobConfig.get_bool "ana.relation.invariant.local" in
let keep_global = GobConfig.get_bool "ana.relation.invariant.global" in

Expand All @@ -772,7 +772,7 @@ struct
PCU.RH.replace results ctx.node new_value;
end;
WideningTokens.with_local_side_tokens (fun () ->
Priv.sync (Analyses.ask_of_ctx ctx) ctx.global ctx.sideg ctx.local (reason :> [`Normal | `Join | `Return | `Init | `Thread])
Priv.sync (Analyses.ask_of_ctx ctx) ctx.global ctx.sideg ctx.local (reason :> [`Normal | `Join | `JoinCall | `Return | `Init | `Thread])
)

let init marshal =
Expand Down
Loading

0 comments on commit 852a453

Please sign in to comment.