Skip to content
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

makes the taint-attached observation on taint introductions #1241

Merged
merged 2 commits into from
Nov 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/bap_taint/bap_taint.ml
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ module Taint = struct

open Machine.Syntax

let report_attached r t v =
Machine.Observation.make attach (r,t,v)

let change v (Rel {field; key}) ~f =
Machine.Local.update tainter ~f:(fun t ->
Expand Down Expand Up @@ -234,15 +236,18 @@ module Taint = struct
(Primus.Value.id value) ~f:(function
| None -> Object.Set.singleton taint
| Some taints -> Set.add taints taint)
}) >>| fun () -> taint
}) >>= fun () ->
report_attached Rel.direct taint value >>| fun () ->
taint

let new_indirect ~addr ~len kind =
Taint.create kind >>= fun taint ->
int_of_value len >>= fun len ->
Machine.Local.get tainter >>= fun s ->
Seq.range 0 len |>
Machine.Seq.fold ~init:s.indirect ~f:(fun indirect off ->
Value.nsucc addr off >>| fun addr ->
Value.nsucc addr off >>= fun addr ->
report_attached Rel.indirect taint addr >>| fun () ->
Map.update indirect addr ~f:(function
| None -> Object.Set.singleton taint
| Some taints -> Set.add taints taint)) >>= fun indirect ->
Expand Down