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_mode crash #24

Closed
vanhauser-thc opened this issue Jul 20, 2019 · 8 comments
Closed

qemu_mode crash #24

vanhauser-thc opened this issue Jul 20, 2019 · 8 comments
Labels
bug Something isn't working

Comments

@vanhauser-thc
Copy link
Member

this crash in qemu only seem to happen with specific input files. weird.

afl-fuzz -Q -i in -o out -- ./xmllint @@

always after exactly 5 seconds of running:

[-] PROGRAM ABORT : Unable to communicate with fork server (OOM?)
         Location : run_target(), afl-fuzz.c:2718

to reproduce:

wget ftp://xmlsoft.org/libxml2/libxml2-2.9.2.tar.gz
tar xzf ibxml2-2.9.2.tar.gz
cd ibxml2-2.9.2
./configure --disable-shared
make
mkdir in
cp ./test/schemas/complex-type-extension_0.xml in/

I tried a few other test xml files but they did not produce a crash

@andreafioraldi - thats more your competence, can you have a look?

@vanhauser-thc vanhauser-thc added the bug Something isn't working label Jul 20, 2019
@andreafioraldi
Copy link
Member

andreafioraldi commented Jul 20, 2019

mmmm this is a problem that affects also afl 2.52b with QEMU 2.1.0.
Instead of aborting with Unable to communicate with fork server (OOM?) it gets stuck without updating the status screen and executing nothing (CPU usage goes from 100% to 0.7% in htop).

In the worst case, there is a bug in the code that compiles blocks when requested in the parent process.

Note that with -d it seems to work.

@andreafioraldi
Copy link
Member

andreafioraldi commented Jul 20, 2019

Ok I have disabled TCG block caching in the parent and the problem is not present now, we are in the worst case. This will be very hard to debug.

@andreafioraldi
Copy link
Member

Update: disabling TCG block chaining the bug disappear so the afl 2.52b bug is different and not present in afl++.

@andreafioraldi
Copy link
Member

The crash is in tb_gen_code when called from afl_wait_tsl. I'm starting to think that this is a QEMU 3.1.0 bug.

@andreafioraldi
Copy link
Member

andreafioraldi commented Jul 20, 2019

OK, I fixed it. This deserves a brief explanation because it has always been a bug in afl qemu_mode.
The problem is that some software create pages of code after the main() like jit compilers or dlopened libraries (when using AFL_INST_LIBS) and then request the translation for caching to the parent process that has not mapped this pages.
The bug does not appear disabling chaining in xmllint only by chance but it is not related to chaining.
The fix is simple, I check in the parent process if the PC of the requested block is valid memory.
IDK what xmllint does but at some point it requests the translation of not mapped memory in the parent.

@andreafioraldi
Copy link
Member

andreafioraldi commented Jul 20, 2019

@vanhauser-thc can you double check the fix testing it on xmllint?

@andreafioraldi
Copy link
Member

andreafioraldi commented Jul 20, 2019

Screenshot at 2019-07-20 13-22-45

Now v8js can be fuzzed in QEMU mode at a shitty speed (95 exec in 2 min lol) but it works.

@vanhauser-thc
Copy link
Member Author

@andreafioraldi - sorry took me long. doesnt crash anymore, great job!

domenukk pushed a commit to domenukk/AFLplusplus that referenced this issue Jul 26, 2019
domenukk pushed a commit to domenukk/AFLplusplus that referenced this issue Jul 26, 2019
abertschi pushed a commit to mattweingarten/AFLplusplus that referenced this issue Apr 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants