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

QEMU 5 #2

Closed
andreafioraldi opened this issue Jun 5, 2019 · 7 comments
Closed

QEMU 5 #2

andreafioraldi opened this issue Jun 5, 2019 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@andreafioraldi
Copy link
Member

andreafioraldi commented Jun 5, 2019

I had some trouble porting to QEMU 4. It works but the exec/sec decrease drammatically.
For example, on tcpdump exec/sec are dropped from ~1650 to ~60.
I can't figure out why this happens and if someone will find why please tag me.

As a note for the future, I didn' use the QEMU helpers cause a patched version of tcg_gen_callN (tcg_gen_afl_maybe_log_call) that only generates calls to afl_maybe_log is faster. It avoids an hashtable lookup for flags and sizemask (I hardcoded them) and many operations related to arguments preparation will be simplified by the compiler.

@andreafioraldi andreafioraldi added the help wanted Extra attention is needed label Jun 5, 2019
@vanhauser-thc vanhauser-thc added the enhancement New feature or request label Jun 6, 2019
domenukk pushed a commit to domenukk/AFLplusplus that referenced this issue Jul 26, 2019
@vanhauser-thc
Copy link
Member

referencing PR #39 I accepted ... might influence this (at least for a decision :) )

@andreafioraldi
Copy link
Member Author

andreafioraldi commented Aug 17, 2019

Yeah i see now the PR #39 , the fix is included in QEMU 4.1.0 (the release of 2 days ago) and so I think that the fix fro afl++ will be the transition to this version.

@andreafioraldi
Copy link
Member Author

QEMU 4.1.0 seems to ignore the cached blocks in the parent.
If I disable parent caching in QEMU 3.1.0 I get the same bad performance.
The code that handle blocks translation is very similar between the two versions of QEMU and I can't figure out why this happens.

@andreafioraldi
Copy link
Member Author

andreafioraldi commented Aug 21, 2019

tb_htable_lookup always returns NULL in the parent, even if called just after tb_gen_code.
E.g.

        mmap_lock();
        tb = tb_gen_code(cpu, t.tb.pc, t.tb.cs_base, t.tb.flags, t.tb.cf_mask);
        fprintf(stderr, " GEN CODE %d  %p : %lx %lx %lx %lx \n", getpid(), tb, t.tb.pc, t.tb.cs_base, t.tb.flags, t.tb.cf_mask);
        tb = tb_htable_lookup(cpu, t.tb.pc, t.tb.cs_base, t.tb.flags, 0);
        fprintf(stderr, " LOOKUP %p : %lx %lx %lx %lx \n", tb, t.tb.pc, t.tb.cs_base, t.tb.flags, t.tb.cf_mask);
        mmap_unlock();

Gives:

 GEN CODE 25779  0x555555cd1740 : 400000c728 0 40c0b3 0 
 LOOKUP (nil) : 400000c728 0 40c0b3 0 

@andreafioraldi
Copy link
Member Author

Porting the 3.1.0 tb_gen_code() routine to 4.1.0 seems to solve this issue and now the speed is double (160 exec/s vs. 80 exec/s) but not already comparable with 3.1.0 speed (1000 exec/s).
Seems that QEMU 4.1.0 instroduced shitty code to handle buffer overflows during translation.

@andreafioraldi
Copy link
Member Author

This is going to be an hell...

@vanhauser-thc
Copy link
Member

qemu 5 is out now, maybe the performance is better now?

@vanhauser-thc vanhauser-thc changed the title QEMU 4 QEMU 5 May 7, 2020
abertschi pushed a commit to mattweingarten/AFLplusplus that referenced this issue Apr 21, 2022
Also define what an experiment is and improve the running_an_experiment.md doc.
vanhauser-thc pushed a commit that referenced this issue Nov 19, 2022
* Add stats information about locations in CMPLOG

* Add CMP Differences Logging

* Improve CMP differences logging

* First sketch

* Fill the taint map

* Fill map working, not filtered yet

* Take smallets hits

* Filtering done

* Add extra optimisations

* Disable optimisations by default

* EXTRA_OPTIMISATIONS

* COURSE_GRAINT

* Disable coarse_taint_map

* Debug cmplog done (#1)

* Disable coarse_taint_map

* Add debug information

* Extra logging

* Add free-taint-map

* Disable logging

* Disable extra optimisations

* Disable extra_optimisations

* New debug

* extra logging

* Extra debug logging

* New debug output

* Debug update

* Remove linked_list taint ref

* Enable fuzzing

* Bug fix

* Enable extra logging

* Debug done, bug fixed

* Debug done, bug fixed (#2)

* Add debug information

* Extra logging

* Add free-taint-map

* Disable logging

* Disable extra optimisations

* Disable extra_optimisations

* New debug

* extra logging

* Extra debug logging

* New debug output

* Debug update

* Remove linked_list taint ref

* Enable fuzzing

* Bug fix

* Enable extra logging

* Debug done, bug fixed

* EXTRA_OPTIMISATIONS

* COURSE_GRAIND

* Bug cause fix

* COURSE GRAIND

* EXTRA_CACHE_TRYOUT

* EXTRA_CACHE FIX

* Remove bool type

* Bug fix; CACHE_TRY

* EXTRA

* IMPR

* COURSEGRAIND

* TRY OUT

* Cleanup
vanhauser-thc pushed a commit that referenced this issue Apr 22, 2023
vanhauser-thc pushed a commit that referenced this issue Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants