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

Add HitcountsIterableMapObserver, rename AsMutIter to AsIterMut #713

Merged
merged 6 commits into from
Jul 28, 2022
Merged

Conversation

domenukk
Copy link
Member

This brings back iterators to HitcountsMapObserver.
I would be surprised if it were a lot slower, @tokatoka pleas check :)

@tokatoka
Copy link
Member

tokatoka commented Jul 27, 2022

I am against moving to iterators tbh...
it makes hitcounts slower
I ran forkserver_simple with introspection feature:
./forkserver_simple ./target/release/program corpus/

Current main build:

[PerfMonitor #0] run time: 0h-0m-15s, clients: 1, corpus: 3, objectives: 1, executions: 109072, exec/sec: 7268
Client 000:
  0.0001: Scheduler
  0.0000: Manager
  Stage 0:
    0.0001: GetInputFromCorpus
    0.0059: Mutate
    0.0000: MutatePostExec
    0.7372: TargetExecution
    0.0045: PreExecObservers
    0.0893: PostExecObservers
  Feedbacks:
    0.1598: mapfeedback_metadata_shared_mem
    0.0002: time
    0.0001: CrashFeedback
  0.0027: Not Measured

[PerfMonitor #0] run time: 0h-0m-30s, clients: 1, corpus: 3, objectives: 1, executions: 218192, exec/sec: 7267
Client 000:
  0.0001: Scheduler
  0.0000: Manager
  Stage 0:
    0.0001: GetInputFromCorpus
    0.0059: Mutate
    0.0000: MutatePostExec
    0.7371: TargetExecution
    0.0045: PreExecObservers
    0.0895: PostExecObservers
  Feedbacks:
    0.1597: mapfeedback_metadata_shared_mem
    0.0002: time
    0.0001: CrashFeedback
  0.0027: Not Measured

^C

iter branch build:

[PerfMonitor #0] run time: 0h-0m-15s, clients: 1, corpus: 3, objectives: 1, executions: 93914, exec/sec: 6255
Client 000:
  0.0003: Scheduler
  0.0000: Manager
  Stage 0:
    0.0002: GetInputFromCorpus
    0.0059: Mutate
    0.0000: MutatePostExec
    0.6957: TargetExecution
    0.0040: PreExecObservers
    0.1477: PostExecObservers
  Feedbacks:
    0.0001: time
    0.0001: CrashFeedback
    0.1437: mapfeedback_metadata_shared_mem
  0.0022: Not Measured

[PerfMonitor #0] run time: 0h-0m-30s, clients: 1, corpus: 3, objectives: 1, executions: 188402, exec/sec: 6273
Client 000:
  0.0003: Scheduler
  0.0000: Manager
  Stage 0:
    0.0002: GetInputFromCorpus
    0.0059: Mutate
    0.0000: MutatePostExec
    0.6954: TargetExecution
    0.0040: PreExecObservers
    0.1479: PostExecObservers
  Feedbacks:
    0.0001: time
    0.0001: CrashFeedback
    0.1438: mapfeedback_metadata_shared_mem
  0.0022: Not Measured

it has nearly 1.6x the time spent for the postexec i.e. hitcountsobserver

@domenukk
Copy link
Member Author

domenukk commented Jul 27, 2022

If the MultiMap has odd-sized maps, this will break/be unsafe

@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2022

Codecov Report

Merging #713 (7da0dbc) into main (a5248d0) will decrease coverage by 0.03%.
The diff coverage is 10.29%.

@@            Coverage Diff             @@
##             main     #713      +/-   ##
==========================================
- Coverage   15.02%   14.99%   -0.04%     
==========================================
  Files         146      146              
  Lines       17336    17377      +41     
==========================================
  Hits         2605     2605              
- Misses      14731    14772      +41     
Impacted Files Coverage Δ
libafl/src/bolts/mod.rs 16.66% <ø> (ø)
libafl/src/feedbacks/map.rs 13.12% <0.00%> (+0.17%) ⬆️
libafl/src/stages/calibrate.rs 0.00% <ø> (ø)
libafl/src/observers/map.rs 4.04% <10.60%> (-0.40%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a5248d0...7da0dbc. Read the comment docs.

@tokatoka
Copy link
Member

How about making another MultiMapHitcountsObserver that can handle multiple maps

@domenukk
Copy link
Member Author

Ooh, or we could have one hitcount observer per sub-map

@domenukk domenukk changed the title Move HitcountsMapObserver back to Iterators Add HitcountsIterableMapObserver, rename AsMutIter to AsIterMut Jul 27, 2022
@domenukk domenukk merged commit 8d5699a into main Jul 28, 2022
@domenukk domenukk deleted the iters branch July 28, 2022 14:03
khang06 pushed a commit to khang06/LibAFL that referenced this pull request Oct 11, 2022
…lusplus#713)

* Move HitcountsMapObserver back to iterators to make it usable with cargo-libafl

* clippy

* optimize the good-case

* safety info added

* mut_iter -> iter_mut

* split up map observer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants