Skip to content

Commit

Permalink
Merge branch 'master' into null-byte-arrayDomain
Browse files Browse the repository at this point in the history
  • Loading branch information
sim642 committed Dec 11, 2023
2 parents f2fdb62 + 18a9aac commit 4577879
Show file tree
Hide file tree
Showing 161 changed files with 841 additions and 3,316 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

- name: Setup Pages
id: pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4

- name: Install dependencies
run: opam install . --deps-only --locked --with-doc
Expand All @@ -68,4 +68,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v3
6 changes: 3 additions & 3 deletions .github/workflows/options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ jobs:
run: npm install -g ajv-cli

- name: Migrate schema # https://github.com/ajv-validator/ajv-cli/issues/199
run: ajv migrate -s src/common/util/options.schema.json
run: ajv migrate -s src/config/options.schema.json

- name: Validate conf
run: ajv validate -s src/common/util/options.schema.json -d "conf/**/*.json"
run: ajv validate -s src/config/options.schema.json -d "conf/**/*.json"

- name: Validate incremental tests
run: ajv validate -s src/common/util/options.schema.json -d "tests/incremental/*/*.json"
run: ajv validate -s src/config/options.schema.json -d "tests/incremental/*/*.json"
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ linux-headers
.goblint*/
goblint_temp_*/

src/spec/graph
.vagrant

g2html.jar
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ build:
- pip install json-schema-for-humans
post_build:
- mkdir _readthedocs/html/jsfh/
- generate-schema-doc --config-file jsfh.yml src/common/util/options.schema.json _readthedocs/html/jsfh/
- generate-schema-doc --config-file jsfh.yml src/config/options.schema.json _readthedocs/html/jsfh/
13 changes: 0 additions & 13 deletions docs/developer-guide/messaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,3 @@ The `~loc` argument is optional and defaults to the current location, but allows
The `_noloc` suffixed functions allow general messages without any location (not even current).

By convention, may-warnings (the usual case) should use warning severity and must-warnings should use error severity.

### Spec analysis

Warnings inside `.spec` files are converted to warnings.
They parsed from string warnings: the first space-delimited substring determines the category and the rest determines the text.

For example:
```
w1 "behavior.undefined.use_after_free"
w2 "integer.overflow"
w3 "unknown my message"
w4 "integer.overflow some text describing the warning"
```
2 changes: 1 addition & 1 deletion docs/user-guide/configuring.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ In `.vscode/settings.json` add the following:
"/conf/*.json",
"/tests/incremental/*/*.json"
],
"url": "/src/common/util/options.schema.json"
"url": "/src/config/options.schema.json"
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion dune-project
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
(depends
(ocaml (>= 4.10))
(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.
(batteries (>= 3.5.0))
(batteries (>= 3.5.1))
(zarith (>= 1.8))
(yojson (>= 2.0.0))
(qcheck-core (>= 0.19))
Expand Down
2 changes: 1 addition & 1 deletion goblint.opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ depends: [
"dune" {>= "3.7"}
"ocaml" {>= "4.10"}
"goblint-cil" {>= "2.0.3"}
"batteries" {>= "3.5.0"}
"batteries" {>= "3.5.1"}
"zarith" {>= "1.8"}
"yojson" {>= "2.0.0"}
"qcheck-core" {>= "0.19"}
Expand Down
2 changes: 1 addition & 1 deletion gobview
Submodule gobview updated 1 files
+2 −0 src/dune
4 changes: 1 addition & 3 deletions scripts/goblint-lib-modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,18 @@
"MessagesCompare",
"PrivPrecCompare",
"ApronPrecCompare",
"Mainspec",

# libraries
"Goblint_std",
"Goblint_timing",
"Goblint_backtrace",
"Goblint_tracing",
"Goblint_sites",
"Goblint_build_info",
"Dune_build_info",

"MessageCategory", # included in Messages
"PreValueDomain", # included in ValueDomain
"SpecCore", # spec stuff
"SpecUtil", # spec stuff

"ConfigVersion",
"ConfigProfile",
Expand Down
1 change: 0 additions & 1 deletion scripts/regression2sv-benchmarks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"09-regions_34-escape_rc", # duplicate of 04/45
"09-regions_35-list2_rc-offsets-thread", # duplicate of 09/03
"10-synch_17-glob_fld_nr", # duplicate of 05/08
"19-spec_02-mutex_rc", # duplicate of 04/01

"29-svcomp_01-race-2_3b-container_of", # duplicate sv-benchmarks
"29-svcomp_01-race-2_4b-container_of", # duplicate sv-benchmarks
Expand Down
27 changes: 0 additions & 27 deletions scripts/spec/check.sh

This file was deleted.

61 changes: 0 additions & 61 deletions scripts/spec/regression.py

This file was deleted.

18 changes: 0 additions & 18 deletions scripts/spec/regression.sh

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/spec/spec.sh

This file was deleted.

2 changes: 1 addition & 1 deletion src/analyses/accessAnalysis.ml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ struct
let init _ =
collect_local := get_bool "witness.yaml.enabled" && get_bool "witness.invariant.accessed";
let activated = get_string_list "ana.activated" in
emit_single_threaded := List.mem (ModifiedSinceLongjmp.Spec.name ()) activated || List.mem (PoisonVariables.Spec.name ()) activated
emit_single_threaded := List.mem (ModifiedSinceSetjmp.Spec.name ()) activated || List.mem (PoisonVariables.Spec.name ()) activated

let do_access (ctx: (D.t, G.t, C.t, V.t) ctx) (kind:AccessKind.t) (reach:bool) (e:exp) =
if M.tracing then M.trace "access" "do_access %a %a %B\n" d_exp e AccessKind.pretty kind reach;
Expand Down
1 change: 0 additions & 1 deletion src/analyses/apron/affineEqualityAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ let spec_module: (module MCPSpec) Lazy.t =
let module AD = AffineEqualityDomain.D2 (VectorMatrix.ArrayVector) (VectorMatrix.ArrayMatrix) in
let module RD: RelationDomain.RD =
struct
module Var = AffineEqualityDomain.Var
module V = AffineEqualityDomain.V
include AD
end
Expand Down
3 changes: 1 addition & 2 deletions src/analyses/apron/apronAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ let spec_module: (module MCPSpec) Lazy.t =
let module AD = (val if diff_box then (module ApronDomain.BoxProd (AD): ApronDomain.S3) else (module AD)) in
let module RD: RelationDomain.RD =
struct
module Var = ApronDomain.Var
module V = ApronDomain.V
include AD
type var = ApronDomain.Var.t
type var = Apron.Var.t
end
in
let module Priv = (val RelationPriv.get_priv ()) in
Expand Down
10 changes: 5 additions & 5 deletions src/analyses/apron/relationAnalysis.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,9 @@ struct
let pass_to_callee fundec any_local_reachable var =
(* TODO: currently, we pass all locals of the caller to the callee, provided one of them is reachbale to preserve relationality *)
(* there should be smarter ways to do this, e.g. by keeping track of which values are written etc. ... *)
(* See, e.g, Beckschulze E, Kowalewski S, Brauer J (2012) Access-based localization for octagons. Electron Notes Theor Comput Sci 287:29–40 *)
(* Also, a local *)
let vname = RD.Var.to_string var in
let vname = Apron.Var.to_string var in
let locals = fundec.sformals @ fundec.slocals in
match List.find_opt (fun v -> VM.var_name (Local v) = vname) locals with (* TODO: optimize *)
| None -> true
Expand All @@ -295,8 +296,7 @@ struct
let st = ctx.local in
let arg_assigns =
GobList.combine_short f.sformals args (* TODO: is it right to ignore missing formals/args? *)
|> List.filter (fun (x, _) -> RD.Tracked.varinfo_tracked x)
|> List.map (Tuple2.map1 RV.arg)
|> List.filter_map (fun (x, e) -> if RD.Tracked.varinfo_tracked x then Some (RV.arg x, e) else None)
in
let arg_vars = List.map fst arg_assigns in
let new_rel = RD.add_vars st.rel arg_vars in
Expand All @@ -318,7 +318,7 @@ struct
RD.remove_filter_with new_rel (fun var ->
match RV.find_metadata var with
| Some (Local _) when not (pass_to_callee fundec any_local_reachable var) -> true (* remove caller locals provided they are unreachable *)
| Some (Arg _) when not (List.mem_cmp RD.Var.compare var arg_vars) -> true (* remove caller args, but keep just added args *)
| Some (Arg _) when not (List.mem_cmp Apron.Var.compare var arg_vars) -> true (* remove caller args, but keep just added args *)
| _ -> false (* keep everything else (just added args, globals, global privs) *)
);
if M.tracing then M.tracel "combine" "relation enter newd: %a\n" RD.pretty new_rel;
Expand Down Expand Up @@ -404,7 +404,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\n" (docList (fun v -> Pretty.text (RD.Var.to_string v))) arg_vars;
if M.tracing then M.tracel "combine" "relation remove vars: %a\n" (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 Down
23 changes: 11 additions & 12 deletions src/analyses/apron/relationPriv.apron.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,7 @@ struct
end
module AV =
struct
include RelationDomain.VarMetadataTbl (VM) (RD.Var)

include RelationDomain.VarMetadataTbl (VM)

let local g = make_var (Local g)
let unprot g = make_var (Unprot g)
Expand Down Expand Up @@ -1011,17 +1010,17 @@ struct
)
)
else (
match ConcDomain.ThreadSet.elements tids with
| [tid] ->
let lmust',l' = G.thread (getg (V.thread tid)) in
{st with priv = (w, LMust.union lmust' lmust, L.join l l')}
| _ ->
(* To match the paper more closely, one would have to join in the non-definite case too *)
(* Given how we handle lmust (for initialization), doing this might actually be beneficial given that it grows lmust *)
st
| exception SetDomain.Unsupported _ ->
(* elements throws if the thread set is top *)
if ConcDomain.ThreadSet.is_top tids then
st
else
match ConcDomain.ThreadSet.elements tids with
| [tid] ->
let lmust',l' = G.thread (getg (V.thread tid)) in
{st with priv = (w, LMust.union lmust' lmust, L.join l l')}
| _ ->
(* To match the paper more closely, one would have to join in the non-definite case too *)
(* Given how we handle lmust (for initialization), doing this might actually be beneficial given that it grows lmust *)
st
)

let thread_return ask getg sideg tid (st: relation_components_t) =
Expand Down
2 changes: 2 additions & 0 deletions src/analyses/base.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2461,10 +2461,12 @@ struct
(* handling thread joins... sort of *)
| ThreadJoin { thread = id; ret_var }, _ ->
let st' =
(* TODO: should invalidate shallowly? https://github.com/goblint/analyzer/pull/1224#discussion_r1405826773 *)
match (eval_rv (Analyses.ask_of_ctx ctx) gs st ret_var) with
| Int n when GobOption.exists (BI.equal BI.zero) (ID.to_int n) -> st
| Address ret_a ->
begin match eval_rv (Analyses.ask_of_ctx ctx) gs st id with
| Thread a when ValueDomain.Threads.is_top a -> invalidate ~ctx (Analyses.ask_of_ctx ctx) gs st [ret_var]
| Thread a ->
let v = List.fold VD.join (VD.bot ()) (List.map (fun x -> G.thread (ctx.global (V.thread x))) (ValueDomain.Threads.elements a)) in
(* TODO: is this type right? *)
Expand Down
Loading

0 comments on commit 4577879

Please sign in to comment.