-
Couldn't load subscription status.
- Fork 84
C-2PO: Thesis About a Weakly-Relational Pointer Analysis #1485
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
michael-schwarz
merged 405 commits into
goblint:master
from
reb-ddm:thesis-weakly-relational-pointer
Mar 24, 2025
Merged
Changes from 174 commits
Commits
Show all changes
405 commits
Select commit
Hold shift + click to select a range
0c41a16
fix issue where startstate answers queries about variables that were …
reb-ddm b4b6712
I'm not sure what to write for the thread functions
reb-ddm 101e247
catch sizeOfError
reb-ddm 0182296
made Lookup Map with just one successor, as it was in the beginning
reb-ddm 06f31d8
new method of restricting the automaton
reb-ddm 8dbbe48
ignore floats and catch an exception
reb-ddm afaf409
fix bugs with offsets
reb-ddm 104360c
add conf file for base analysis with which we can compare wrpointer
reb-ddm 50f9671
add tracing for get_normal_form
reb-ddm b98d18f
Merge branch 'thesis-weakly-relational-pointer' into thesis-wrpointer…
reb-ddm e758b5e
made sure to always just add pointers to the data structure
reb-ddm 9e8c10b
fixed bug in find of union-find
reb-ddm 12f64f2
properly update offset of long integers
reb-ddm d72d622
add regression test for widen
reb-ddm 2b4fdd1
revert wrong fix
reb-ddm 2135fea
adapt test case
reb-ddm 944bc95
replace Z.of_int 1 with Z.one
reb-ddm e297335
remove var-eq analysis from conf file
reb-ddm babee14
intersect answers of MayPointTo query for equal pointers
reb-ddm 267294c
implicitly assume that &x != &y
reb-ddm 0e647d2
implicitly assume that &x != &y
reb-ddm c2f704b
Merge branch 'thesis-weakly-relational-pointer' of github.com:reb-ddm…
reb-ddm da7cdb4
started implementing auxiliaries, but it doesn't quite work yet
reb-ddm 8d04d60
solved exception, maybe not in the best possible way
reb-ddm bce1a8c
don't answer maypointto query any more
reb-ddm f45c6c2
only add valid terms when we add successor terms
reb-ddm 27f11b5
fix regression test
reb-ddm 9152fc0
fix compare function of propositions and is_struct_type function
reb-ddm 99ae3c1
Merge branch 'thesis-weakly-relational-pointer' into thesis-wrpointer…
reb-ddm 2f91d09
add auxiliaries to to_cil
reb-ddm e5431b2
Shortcut equal
michael-schwarz 049aa07
Shortcut join
michael-schwarz 9b97233
Short circuit meet
michael-schwarz 3397e3b
Reuse var
michael-schwarz 990af99
Optimize some calls
michael-schwarz 31ff5fb
New `find_successor_in_set`
michael-schwarz 55ec005
support an additional type of dereferencing
reb-ddm 35c846c
Merge branch 'thesis-weakly-relational-pointer' of github.com:reb-ddm…
reb-ddm fd8ae21
fixed indentation
reb-ddm 176dc42
add first code for block disequalities
reb-ddm acc5060
added block diseq handling for malloc
reb-ddm 57c50d7
add remove for block disequalities
reb-ddm 769df6b
implemented equal for block diseqs
reb-ddm 376fe87
add join for block disequalities
reb-ddm a01bead
update the representatives of block disequalities
reb-ddm 97584b2
add meet for block disequalities
reb-ddm c6f0e63
add meet for block disequalities
reb-ddm 31e009b
Merge branch 'thesis-weakly-relational-pointer' into thesis-wrpointer…
reb-ddm 8642eeb
may point to query for all elements in the equivalence class
reb-ddm 354e4a0
fixed bug with Casts and auxiliaries and made join more elegant
reb-ddm 814446f
fixed may_point_to and implemented query for all elements in equivale…
reb-ddm 4d2f750
fix bug that comes from the fact that block disequalities can possibl…
reb-ddm d8baa37
removed some unused rec flags
reb-ddm a5ffa24
Merge branch 'master' into thesis-weakly-relational-pointer
reb-ddm 3dd5c5c
moved union find to another file
reb-ddm 1ed0bd5
copy the whole wrpointer analysis and give it another name
reb-ddm 3629d9d
removed everything that has to do woth minimal representatives from c2po
reb-ddm 0eca795
added exactly the same tests as the wrpointer tests also to c2po. The…
reb-ddm d139d80
simplified the jooin operation
reb-ddm 1c59fc6
I think I implemented the simplified restriction. I'll have to look a…
reb-ddm e3c71e8
implemented equality for c2po
reb-ddm e64541b
replaced wrpointer with c2po for the tracing
reb-ddm 9ace51b
updated tests for c2po
reb-ddm f89d0b2
added conf file for c2po
reb-ddm 9e3ad40
update comments and make some order
reb-ddm 55f7d5f
fixed name of test folder
reb-ddm e251e19
make it configurable if we want to use maypointto for c2po or not. Up…
reb-ddm ea433bb
made a single-threaded analysis lifter
reb-ddm 4dbe6c0
fix equality function of c2po
reb-ddm 1d476df
(really) fixed equality
reb-ddm 83bf565
put back old version of restriction, where we add successors, because…
reb-ddm d2600d7
is_root now works also with elements that are not in the uf
reb-ddm e64d502
implemented widen and narrow
reb-ddm 530f9ef
some shortcuts, maybe they help
reb-ddm 807eefe
reswitched to the new version of restricting. Because the prof wrote …
reb-ddm 286d1be
removed all code duplication, but I also removed min_repr, so I will …
reb-ddm f484cd2
use MustBeSingleThreaded instead of IsEverMultithreaded
reb-ddm 0b8305c
move the short-circuit after the match
reb-ddm 2b2e0a2
fix is_top: now it takes into account the disequalities
reb-ddm 79bbc07
fix code
reb-ddm 965be40
moved MayBeEqual to CongruenceClosure.ml
reb-ddm cbd7bf6
merged wrpointerDomain with c2poDomain
reb-ddm abeb2a2
merge wrpointerAnalysis and c2poAnalysis
reb-ddm 2b4fc1f
rename everything to c2po
reb-ddm eb09f11
add configurations for choosing which join and which equal algorithm …
reb-ddm da0ea4a
update tracing
reb-ddm dc2a4be
fix the join and widen etc. It was because I didn't explicitly write …
reb-ddm 40678f6
use --enable instead of --set
reb-ddm c665548
fix unsound behaviour
reb-ddm 2840b4c
fix arithmeticonintegerbot and invalid_widen
reb-ddm ba0c28e
change tracing a bit
reb-ddm cb6bc2a
fix block disequality query
reb-ddm 0df379e
implemented Invariant
reb-ddm ada5779
implemented Invariant
reb-ddm 700017f
remove unused rec flag
reb-ddm 8173b99
Horrible, horrible fix. May the gods forgive us!
michael-schwarz af4e693
add conf file for the tests with witnesses
reb-ddm 5169a97
changed my mind
reb-ddm 887ab98
now I'm the only one that answers the invariant query
reb-ddm 6f64f8f
fix invariant
reb-ddm 0568de8
Revert "now I'm the only one that answers the invariant query"
reb-ddm be00c1d
removed unused function and added tracing
reb-ddm dbf30c9
merge changes
reb-ddm 249e595
fix name of function
reb-ddm 18b3c10
use get_conjunction instead of get_noemal_form for meet
reb-ddm b08fa56
fix indentation
reb-ddm 82a5cca
re-add min_repr, but it doesn't quite work yet
reb-ddm 690eb44
remove init_congruence
reb-ddm d1f4f89
add some tracing
reb-ddm 17f0954
fix bug when adding disequalities
reb-ddm 35f4b05
fix join; less code duplication
reb-ddm d10a49f
always first update block disequalities and then normal disequalities
reb-ddm c3479f4
remove some TODOs
reb-ddm 28ba650
make code for element_closure a bit better
reb-ddm 79dacf2
simplify removal of block disequalities
reb-ddm b2b75a2
maybe fixed combine_env?
reb-ddm b95e2c6
optimize minimal representatives
reb-ddm 44668a4
less code duplication for get_normal_form
reb-ddm 5f2b938
simplify insertion a bit
reb-ddm 2af0179
add calloc and alloca and realloc to special
reb-ddm fbe1310
removed unused things
reb-ddm 6a35b05
forget var information in special
reb-ddm 96916bb
no need to calculate the closure of disequalities after an insertion …
reb-ddm 94d2896
fixed enter/combine
reb-ddm 9f6cd4b
fixed realloc
reb-ddm c1f8942
Merge with the other branch where I have been coding
reb-ddm b4028a1
rename module to c2po
reb-ddm b77fec3
made normal form a lazy record field
reb-ddm 407d8cf
fixed warning
reb-ddm 2255dc0
recompute min_repr in the appropriate places
reb-ddm d155b89
indentation
reb-ddm fe6e9d0
add tracing
reb-ddm cd48307
a bit more path compression
reb-ddm 0576b89
restore find_no_pc
reb-ddm 13c4de6
Timing.wrap
reb-ddm 4527ece
solved invariant bug in a better way
reb-ddm a25ef22
ask MayBeTainted in combine_env instead of start State
reb-ddm 1ea9488
remove the weird hack I put in startState
reb-ddm cc148ef
simplify redundant definitions in startState
reb-ddm 6de5039
Merge branch 'master' into thesis-weakly-relational-pointer
reb-ddm 82d3802
disable unknown_function.call for c2po conf
reb-ddm b55075f
added different conf files for the 4 possibilities of c2po
reb-ddm 1dc5301
fixed lazy computation and added timings.wrap
reb-ddm d46b4b7
added a widen operator for the join with automaton as described in my…
reb-ddm f58d2bd
fixed bug in normal form
reb-ddm 1653e28
fix invalid_widen bug
reb-ddm 6ba1cc7
outsource variable handling
reb-ddm d963273
make everything compatible with the new duplicated vars
reb-ddm ecb67da
replace wrpointer with c2po
reb-ddm 6edd0ac
fixed bugs. Needs to be tested
reb-ddm 8efe09c
fix some things
reb-ddm e561383
add Var.
reb-ddm b0ce431
I think this is not necessary
reb-ddm cfd155e
use the other method for variable duplication
reb-ddm c28f503
rename shadow to duplicated
reb-ddm d9de485
fix indentation
reb-ddm 85ad21d
remove some unused functions and add some comments
reb-ddm 498cd40
remove useless module
reb-ddm c16366c
add some comments and adapt the structure of the code
reb-ddm 89ec5e2
update comments
reb-ddm 5d940cd
adress -> address
reb-ddm 924ccc2
Merge branch 'master' into thesis-weakly-relational-pointer
reb-ddm 30949fd
remove unused polymorphism
reb-ddm b3ea845
remove redundant compare
reb-ddm da75386
use Cilfacade.isFloatType snf Cil.unrollType
reb-ddm 448768e
change error to TypoOfError
reb-ddm eabeec9
explain better what singleThreadedLifter is for
reb-ddm 1e5e645
do not recompute compare
reb-ddm f6133c9
fix invariant generation bug
reb-ddm 599dfd4
remove confs
reb-ddm 0d1470a
Revert "Horrible, horrible fix. May the gods forgive us!"
reb-ddm 85c08ec
derive equality of propositions
reb-ddm 6b269fd
use Lattice.LiftBot
reb-ddm 03fca72
catch exception
reb-ddm 07ab99a
implemented pretty_diff
reb-ddm e22a989
remove debug print
reb-ddm addbbd4
make precise_join an enum
reb-ddm 80f68fc
make normal_form an enum
reb-ddm 39b2261
fix bug
reb-ddm c9a7e04
change the location od c2poAnalysis in Goblint_lib
reb-ddm cb9dc2f
modify richvarinfo to make it possible to change all the other fields…
reb-ddm f787e67
Merge branch 'master' into thesis-weakly-relational-pointer
michael-schwarz 5739f94
Fix description of ana.c2po.join_algorithm
jerhard 86f763f
Remove superfluous parentheses
jerhard b3967a4
Improve indentation.
jerhard 9971145
Remove superfluous parentheses
jerhard 63eead9
Improve indentation.
jerhard c8c687e
Improve indentation.
jerhard 6dd83a0
Remove unused modules in startStateAnalysis.
jerhard dc6908f
Improve readability of block disequality module in congruence closure.
jerhard eb76ce1
Improve code in Disequalities module in congruence closure.
jerhard 57480c8
Improve readability of disequalitiesdomain.
jerhard 3b87bd7
Improve readability of check_neq and check_neq_bl in disequalities, e…
jerhard ed70090
Improve readability of init_list_neq.
jerhard c6c6795
Improve readability of some functions in Disequalities in concgurence…
jerhard 88532a6
Remove unusud show function and bindings_args.
jerhard 0e95b85
Improve readability of last functions in Disequalities in congruence …
jerhard ee07cc0
Improve readability of functions in SSet in congruence closure.
jerhard 8e1f0ee
Improve readability of CongruenceClosure.MRMap.
jerhard b28cf1d
Congruence Closure: Avoid comparing and hasing of lazily computed nor…
jerhard ff6b71b
Improve readability of some functions in CongruenceClosure.
jerhard 8a9ffd1
Add example where precision of C-2PO could be improved.
jerhard 39015f3
Improve readability of closure and congruence_neq in CongruenceClosure.
jerhard 297f897
Simplify update_bldis.
jerhard 2e3a717
Improve readability of functions in CongruenceClosure.
jerhard c90e1af
Improve readability of some functions in CongruenceClosure.
jerhard 0c3b3f1
Remove unused show_pmap function.
jerhard 41ab8ee
Indent CongruenceClosure.show_all function.
jerhard be82322
CongruenceClosure: Improve readability of some functions; add failwit…
jerhard 7bae071
Improve readability of CongruenceClosure functions.
jerhard acc4018
Rename s parameter to size for readability.
jerhard 6dc1b11
Improve readability of c2poDomain.
jerhard 85b19c2
Make tracing text mixed case instead of upper case.
jerhard 155e798
Improve code indentation of SingleThreadedLifter.
jerhard a37db4b
Simplify StartStateAnalysis and improve readability.
jerhard 40c8959
Remove todo about introducing separate query for ghost variables.
jerhard 01cb1dc
C2POAnalysis: Improve reachable_from_args readability, change accumul…
jerhard c443257
C2PO: Improve readability of some functions in C2PO analysis.
jerhard dd4556d
C2PO: Improve readability of some functions in c2poanalysis.
jerhard 0fb3b80
C2PO: Improve readability of c2poanalysis, rename t to cc.
jerhard e2e2e3d
Put M.trace in one line.
jerhard 05e64cc
C2PO tracing: Use lower casing instead of UPPERCASING for tracing.
jerhard 5df3b5e
C2PO DuplicateVars: Remark todos for incremental, improve readability.
jerhard 1c36383
C2PO DuplicateVars: Add newlines for better readability.
jerhard d869801
C2PO: Improve readability of some functions in UnionFind.
jerhard e093e5b
C2PO: Fix non-termination of type comparison by using compare instead…
jerhard 0cdd288
C2PO: Improve readability of unionFind.
jerhard 3256cf8
Fix get_representatives.
jerhard 6dd7315
Rename variables in get_representtives.
jerhard 59d9fb5
C2PO: Define types for arguments of prop constructors.
jerhard 9fe6048
Remove outdated comment.
jerhard bbfffe1
C2PO: Adapt comment about duplication, since duplicated code is modif…
jerhard 1c667a7
C2PO: Fix comment of UnionFind.find
jerhard db77cfb
C2PO: Fix comment for find_no_pc.
jerhard 0f9c8ac
C2PO: Make evaluation of last line of remove_terms_from_bldis more cl…
jerhard 11e3667
Merge master into c2po.
jerhard 1377a28
C2PO: Fix naming of DuplicVar.
jerhard 2059391
C2PO: Adapt C2PO such that is does not read attributes from richvarin…
jerhard a434566
Merge branch 'master' into c2po
jerhard cd52bde
Remove not useful test case.
jerhard 5f9b2d7
C2PO: Fix test case to incur no warnings, besides for __goblint_check.
jerhard 3ad5c05
Merge branch 'master' into thesis-weakly-relational-pointer
michael-schwarz 38bc810
Add include goblint.h
jerhard 6ddf176
Remove no longer necessary name_varinfo definition.
jerhard e09ce9f
C2PO: Use CilType.Typ for equal, compare and hash in DuplicateVars.
jerhard 1fdaa06
Replace UnionFind.is_ptr_type with existing GoblintCil.isPointerType.
jerhard 2c21687
Add missing include goblint.h to regression tests.
jerhard f070f2a
Improve readability of UnionFind.get_size_in_bits.
jerhard 1eb6153
Add Cil.unrollType in unionFind.
jerhard 078d7f5
C2PO tests: avoid undefined behavior (signed overflow) in one test case.
jerhard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,145 @@ | ||
| { | ||
| "ana": { | ||
| "sv-comp": { | ||
| "enabled": true, | ||
| "functions": true | ||
| }, | ||
| "int": { | ||
| "def_exc": true, | ||
| "enums": false, | ||
| "interval": true | ||
| }, | ||
| "float": { | ||
| "interval": true | ||
| }, | ||
| "activated": [ | ||
| "base", | ||
| "threadid", | ||
| "threadflag", | ||
| "threadreturn", | ||
| "mallocWrapper", | ||
| "mutexEvents", | ||
| "mutex", | ||
| "access", | ||
| "race", | ||
| "escape", | ||
| "expRelation", | ||
| "mhp", | ||
| "assert", | ||
| "symb_locks", | ||
| "region", | ||
| "thread", | ||
| "threadJoins" | ||
| ], | ||
| "path_sens": [ | ||
| "mutex", | ||
| "malloc_null", | ||
| "uninit", | ||
| "expsplit", | ||
| "activeSetjmp", | ||
| "memLeak", | ||
| "threadflag" | ||
| ], | ||
| "context": { | ||
| "widen": false | ||
| }, | ||
| "malloc": { | ||
| "wrappers": [ | ||
| "kmalloc", | ||
| "__kmalloc", | ||
| "usb_alloc_urb", | ||
| "__builtin_alloca", | ||
| "kzalloc", | ||
|
|
||
| "ldv_malloc", | ||
|
|
||
| "kzalloc_node", | ||
| "ldv_zalloc", | ||
| "kmalloc_array", | ||
| "kcalloc", | ||
|
|
||
| "ldv_xmalloc", | ||
| "ldv_xzalloc", | ||
| "ldv_calloc", | ||
| "ldv_kzalloc" | ||
| ] | ||
| }, | ||
| "base": { | ||
| "arrays": { | ||
| "domain": "partitioned" | ||
| } | ||
| }, | ||
| "race": { | ||
| "free": false, | ||
| "call": false | ||
| }, | ||
| "autotune": { | ||
| "enabled": true, | ||
| "activated": [ | ||
| "singleThreaded", | ||
| "mallocWrappers", | ||
| "noRecursiveIntervals", | ||
| "enums", | ||
| "congruence", | ||
| "octagon", | ||
| "wideningThresholds", | ||
| "loopUnrollHeuristic", | ||
| "memsafetySpecification", | ||
| "termination", | ||
| "tmpSpecialAnalysis" | ||
| ] | ||
| } | ||
| }, | ||
| "exp": { | ||
| "region-offsets": true | ||
| }, | ||
| "solver": "td3", | ||
| "sem": { | ||
| "unknown_function": { | ||
| "spawn": false | ||
| }, | ||
| "int": { | ||
| "signed_overflow": "assume_none" | ||
| }, | ||
| "null-pointer": { | ||
| "dereference": "assume_none" | ||
| } | ||
| }, | ||
| "witness": { | ||
| "graphml": { | ||
| "enabled": true, | ||
| "id": "enumerate", | ||
| "unknown": false | ||
| }, | ||
| "yaml": { | ||
| "enabled": true, | ||
| "format-version": "2.0", | ||
| "entry-types": [ | ||
| "invariant_set" | ||
| ], | ||
| "invariant-types": [ | ||
| "loop_invariant" | ||
| ] | ||
| }, | ||
| "invariant": { | ||
| "loop-head": true, | ||
| "after-lock": false, | ||
| "other": false, | ||
| "accessed": false, | ||
| "exact": true, | ||
| "exclude-vars": [ | ||
| "tmp\\(___[0-9]+\\)?", | ||
| "cond", | ||
| "RETURN", | ||
| "__\\(cil_\\)?tmp_?[0-9]*\\(_[0-9]+\\)?", | ||
| ".*____CPAchecker_TMP_[0-9]+", | ||
| "__VERIFIER_assert__cond", | ||
| "__ksymtab_.*", | ||
| "\\(ldv_state_variable\\|ldv_timer_state\\|ldv_timer_list\\|ldv_irq_\\(line_\\|data_\\)?[0-9]+\\|ldv_retval\\)_[0-9]+" | ||
| ] | ||
| } | ||
| }, | ||
| "pre": { | ||
| "enabled": false | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,148 @@ | ||
| { | ||
| "ana": { | ||
| "sv-comp": { | ||
| "enabled": true, | ||
| "functions": true | ||
| }, | ||
| "int": { | ||
| "def_exc": true, | ||
| "enums": false, | ||
| "interval": true | ||
| }, | ||
| "float": { | ||
| "interval": true | ||
| }, | ||
| "activated": [ | ||
| "base", | ||
| "threadid", | ||
| "threadflag", | ||
| "threadreturn", | ||
| "mallocWrapper", | ||
| "mutexEvents", | ||
| "mutex", | ||
| "access", | ||
| "race", | ||
| "escape", | ||
| "expRelation", | ||
| "mhp", | ||
| "assert", | ||
| "symb_locks", | ||
| "region", | ||
| "thread", | ||
| "threadJoins", | ||
| "wrpointer", | ||
| "startState", | ||
| "taintPartialContexts" | ||
| ], | ||
| "path_sens": [ | ||
| "mutex", | ||
| "malloc_null", | ||
| "uninit", | ||
| "expsplit", | ||
| "activeSetjmp", | ||
| "memLeak", | ||
| "threadflag" | ||
| ], | ||
| "context": { | ||
| "widen": false | ||
| }, | ||
| "malloc": { | ||
| "wrappers": [ | ||
| "kmalloc", | ||
| "__kmalloc", | ||
| "usb_alloc_urb", | ||
| "__builtin_alloca", | ||
| "kzalloc", | ||
|
|
||
| "ldv_malloc", | ||
|
|
||
| "kzalloc_node", | ||
| "ldv_zalloc", | ||
| "kmalloc_array", | ||
| "kcalloc", | ||
|
|
||
| "ldv_xmalloc", | ||
| "ldv_xzalloc", | ||
| "ldv_calloc", | ||
| "ldv_kzalloc" | ||
| ] | ||
| }, | ||
| "base": { | ||
| "arrays": { | ||
| "domain": "partitioned" | ||
| } | ||
| }, | ||
| "race": { | ||
| "free": false, | ||
| "call": false | ||
| }, | ||
| "autotune": { | ||
| "enabled": true, | ||
| "activated": [ | ||
| "singleThreaded", | ||
| "mallocWrappers", | ||
| "noRecursiveIntervals", | ||
| "enums", | ||
| "congruence", | ||
| "octagon", | ||
| "wideningThresholds", | ||
| "loopUnrollHeuristic", | ||
| "memsafetySpecification", | ||
| "termination", | ||
| "tmpSpecialAnalysis" | ||
| ] | ||
| } | ||
| }, | ||
| "exp": { | ||
| "region-offsets": true | ||
| }, | ||
| "solver": "td3", | ||
| "sem": { | ||
| "unknown_function": { | ||
| "spawn": false | ||
| }, | ||
| "int": { | ||
| "signed_overflow": "assume_none" | ||
| }, | ||
| "null-pointer": { | ||
| "dereference": "assume_none" | ||
| } | ||
| }, | ||
| "witness": { | ||
| "graphml": { | ||
| "enabled": true, | ||
| "id": "enumerate", | ||
| "unknown": false | ||
| }, | ||
| "yaml": { | ||
| "enabled": true, | ||
| "format-version": "2.0", | ||
| "entry-types": [ | ||
| "invariant_set" | ||
| ], | ||
| "invariant-types": [ | ||
| "loop_invariant" | ||
| ] | ||
| }, | ||
| "invariant": { | ||
| "loop-head": true, | ||
| "after-lock": false, | ||
| "other": false, | ||
| "accessed": false, | ||
| "exact": true, | ||
| "exclude-vars": [ | ||
| "tmp\\(___[0-9]+\\)?", | ||
| "cond", | ||
| "RETURN", | ||
| "__\\(cil_\\)?tmp_?[0-9]*\\(_[0-9]+\\)?", | ||
| ".*____CPAchecker_TMP_[0-9]+", | ||
| "__VERIFIER_assert__cond", | ||
| "__ksymtab_.*", | ||
| "\\(ldv_state_variable\\|ldv_timer_state\\|ldv_timer_list\\|ldv_irq_\\(line_\\|data_\\)?[0-9]+\\|ldv_retval\\)_[0-9]+" | ||
| ] | ||
| } | ||
| }, | ||
| "pre": { | ||
| "enabled": false | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| (** Remembers the abstract address value of each parameter at the beginning of each function by adding a ghost variable for each parameter. | ||
| Used by the wrpointer anaylysis. *) | ||
|
|
||
| open GoblintCil | ||
| open Batteries | ||
| open Analyses | ||
|
|
||
|
|
||
| (*First all parameters (=formals) of the function are duplicated (by negating their ID), | ||
| then we remember the value of each local variable at the beginning of the function | ||
| in this new duplicated variable. *) | ||
| module Spec : Analyses.MCPSpec = | ||
| struct | ||
| let name () = "startState" | ||
| module VD = BaseDomain.VD | ||
| module AD = ValueDomain.AD | ||
| module Value = AD | ||
| module D = MapDomain.MapBot (Basetype.Variables) (Value) | ||
| module C = D | ||
|
|
||
| include Analyses.IdentitySpec | ||
|
|
||
|
|
||
| let duplicated_variable var = { var with vid = - var.vid - 4; vname = "wrpointer__" ^ var.vname ^ "'" } | ||
| let original_variable var = { var with vid = - (var.vid + 4); vname = String.lchop ~n:11 @@ String.rchop var.vname } | ||
| let return_varinfo = {dummyFunDec.svar with vid=(-2);vname="wrpointer__@return"} | ||
| let is_wrpointer_ghost_variable x = x.vid < 0 && String.starts_with x.vname "wrpointer__" | ||
|
|
||
|
|
||
| let get_value (ask: Queries.ask) exp = ask.f (MayPointTo exp) | ||
|
|
||
| (** If e is a known variable, then it returns the value for this variable. | ||
| If e is &x' for a duplicated variable x' of x, then it returns MayPointTo of &x. | ||
| If e is an unknown variable or an expression that is not simply a variable, then it returns top. *) | ||
| let eval (ask: Queries.ask) (d: D.t) (exp: exp): Value.t = match exp with | ||
| | Lval (Var x, NoOffset) -> begin match D.find_opt x d with | ||
| | Some v -> if M.tracing then M.trace "wrpointer-tainted" "QUERY %a : res = %a\n" d_exp exp AD.pretty v;v | ||
| | None -> Value.top() | ||
| end | ||
| | AddrOf (Var x, NoOffset) -> if is_wrpointer_ghost_variable x then (let res = get_value ask (AddrOf (Var (original_variable x), NoOffset)) in if M.tracing then M.trace "wrpointer-tainted" "QUERY %a, id: %d : res = %a\n" d_exp exp x.vid AD.pretty res;res) else Value.top() | ||
| | _ -> Value.top () | ||
|
|
||
| let startcontext () = D.empty () | ||
| let startstate v = D.bot () | ||
| let exitstate = startstate | ||
|
|
||
| (* TODO: there should be a better way to do this, this should be removed here. *) | ||
| let return ctx exp_opt f = | ||
| (* remember all values of local vars *) | ||
| let st = List.fold_left (fun st var -> let value = get_value (ask_of_ctx ctx) (Lval (Var var, NoOffset)) in | ||
| if M.tracing then M.trace "startState" "return: added value: var: %a; value: %a" d_lval (Var var, NoOffset) Value.pretty value; | ||
| D.add (var) value st) (D.empty()) (f.sformals @ f.slocals) in | ||
| (* remember value of tainted vars in the return variable *) | ||
| let tainted = ctx.ask (MayBeTainted) in | ||
| let st = D.add return_varinfo tainted st | ||
| in if M.tracing then M.tracel "wrpointer-tainted" "startState: %a; state: %a\n" AD.pretty tainted D.pretty st;st | ||
|
|
||
|
|
||
| let query ctx (type a) (q: a Queries.t): a Queries.result = | ||
| let open Queries in | ||
| match q with | ||
| | MayPointTo e -> eval (ask_of_ctx ctx) ctx.local e | ||
jerhard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| | EvalValue e -> Address (eval (ask_of_ctx ctx) ctx.local e) | ||
| | _ -> Result.top q | ||
|
|
||
| let enter ctx var_opt f args = | ||
| [ctx.local, ctx.local] | ||
|
|
||
| let body ctx (f:fundec) = | ||
| (* assign function parameters *) | ||
| List.fold_left (fun st var -> let value = get_value (ask_of_ctx ctx) (Lval (Var var, NoOffset)) in | ||
| if M.tracing then M.trace "startState" "added value: var: %a; value: %a" d_lval (Var (duplicated_variable var), NoOffset) Value.pretty value; | ||
| D.add (duplicated_variable var) value st) (D.empty()) f.sformals | ||
|
|
||
| let combine_env ctx (lval:lval option) fexp (f:fundec) (args:exp list) fc au (f_ask: Queries.ask) = | ||
| ctx.local | ||
|
|
||
| let combine_assign ctx var_opt expr f exprs t_context_opt t ask = | ||
| (* remove duplicated vars and local vars *) | ||
| ctx.local | ||
|
|
||
| end | ||
|
|
||
| let _ = | ||
| MCP.register_analysis (module Spec : MCPSpec) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.