Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
3b8c0f3f
Commit
3b8c0f3f
authored
3 years ago
by
David Bühler
Browse files
Options
Downloads
Patches
Plain Diff
[Eva] Taint domain: identifies tainted properties.
parent
4f0b2446
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/plugins/value/domains/taint_domain.ml
+42
-0
42 additions, 0 deletions
src/plugins/value/domains/taint_domain.ml
src/plugins/value/domains/taint_domain.mli
+10
-0
10 additions, 0 deletions
src/plugins/value/domains/taint_domain.mli
with
52 additions
and
0 deletions
src/plugins/value/domains/taint_domain.ml
+
42
−
0
View file @
3b8c0f3f
...
@@ -559,3 +559,45 @@ let flag =
...
@@ -559,3 +559,45 @@ let flag =
Abstractions
.
register
~
name
~
descr
~
experimental
abstraction
Abstractions
.
register
~
name
~
descr
~
experimental
abstraction
let
()
=
Abstractions
.
register_hook
interpret_taint_logic
let
()
=
Abstractions
.
register_hook
interpret_taint_logic
type
taint_error
=
NotComputed
|
Irrelevant
|
LogicError
let
zone_of_predicate
env
predicate
=
let
logic_deps
=
Eval_terms
.
predicate_deps
env
predicate
in
let
deps_list
=
Option
.
map
Logic_label
.
Map
.
bindings
logic_deps
in
match
deps_list
with
|
Some
[
BuiltinLabel
Here
,
zone
]
->
Ok
zone
|
_
->
Error
LogicError
let
get_predicate
=
function
|
Property
.
IPCodeAnnot
ica
->
begin
match
ica
.
ica_ca
.
annot_content
with
|
AAssert
(
_
,
predicate
)
|
AInvariant
(
_
,
_
,
predicate
)
->
Ok
predicate
.
tp_statement
|
_
->
Error
Irrelevant
end
|
IPPropertyInstance
{
ii_pred
=
None
}
->
Error
LogicError
|
IPPropertyInstance
{
ii_pred
=
Some
pred
}
->
Ok
pred
.
ip_content
.
tp_statement
|
_
->
Error
Irrelevant
let
get_stmt
ip
=
let
kinstr
=
Property
.
get_kinstr
ip
in
match
kinstr
with
|
Kglobal
->
Error
Irrelevant
|
Kstmt
stmt
->
Ok
stmt
let
is_tainted_property
ip
=
let
(
let
+
)
=
Result
.
bind
in
if
not
(
Store
.
is_computed
()
)
then
Error
NotComputed
else
let
+
stmt
=
get_stmt
ip
in
let
+
predicate
=
get_predicate
ip
in
match
Store
.
get_stmt_state
~
after
:
false
stmt
with
|
`Bottom
->
Ok
false
|
`Value
state
->
let
cvalue
=
Db
.
Value
.
get_stmt_state
~
after
:
false
stmt
in
let
env
=
Eval_terms
.
env_only_here
cvalue
in
let
+
zone
=
zone_of_predicate
env
predicate
in
let
tainted
=
Zone
.
intersects
zone
state
.
locs_data
in
Ok
tainted
This diff is collapsed.
Click to expand it.
src/plugins/value/domains/taint_domain.mli
+
10
−
0
View file @
3b8c0f3f
...
@@ -27,3 +27,13 @@ include Abstract_domain.Leaf
...
@@ -27,3 +27,13 @@ include Abstract_domain.Leaf
and
type
location
=
Precise_locs
.
precise_location
and
type
location
=
Precise_locs
.
precise_location
val
flag
:
Abstractions
.
flag
val
flag
:
Abstractions
.
flag
type
taint_error
=
|
NotComputed
(** The Eva analysis has not been run, or the taint domain
were not enabled. *)
|
Irrelevant
(** Properties other than assertions, invariants and
preconditions are irrelevant here. *)
|
LogicError
(** The memory zone on which the property depends could not
be computed. *)
val
is_tainted_property
:
Property
.
t
->
(
bool
,
taint_error
)
result
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment