shellphish / fuzzer

A Python interface to AFL, allowing for easy injection of testcases and other functionality.
BSD 2-Clause "Simplified" License
636 stars 130 forks source link

Installation error #30

Open awakened1712 opened 5 years ago

awakened1712 commented 5 years ago

I got this when I tried pip install git+https://github.com/shellphish/shellphish-afl

    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c: In function ‘cpu_resume_from_signal’:
    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:71:37: error: dereferencing pointer to incomplete type ‘struct ucontext’
             sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL);
                                         ^~
    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c: In function ‘cpu_x86_signal_handler’:
    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:213:41: error: dereferencing pointer to incomplete type ‘struct ucontext’
     #define PC_sig(context)       ((context)->uc_mcontext.gregs[REG_RIP])
                                             ^
    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:232:10: note: in expansion of macro ‘PC_sig’
         pc = PC_sig(uc);
              ^~~~~~
    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:237:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    /tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/rules.mak:57: recipe for target 'user-exec.o' failed
    make[2]: *** [user-exec.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    Makefile:173: recipe for target 'subdir-i386-linux-user' failed
    make[1]: *** [subdir-i386-linux-user] Error 2
    make[1]: Leaving directory '/tmp/pip-ugqYQB-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu'
    Makefile:2: recipe for target 'all' failed
    make: *** [all] Error 1
    error: Unable to make afl-multi-cgc

Anything that can be done from my side for this?

rhelmot commented 5 years ago

Yes actually - I fixed this while getting the python 3 port ready a few weeks ago. It’ll merge in another few weeks when all of angr migrates, but in the meantime it’s on the py3k branch. You can either backport my relevant changes or just switch to python 3.

awakened1712 commented 5 years ago

I tried python3 too pip3 install git+https://github.com/shellphish/shellphish-afl. It didn't work either

    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c: In function ‘cpu_resume_from_signal’:
    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:71:37: error: dereferencing pointer to incomplete type ‘struct ucontext’
             sigprocmask(SIG_SETMASK, &uc->uc_sigmask, NULL);
                                         ^~
    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c: In function ‘cpu_x86_signal_handler’:
    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:213:41: error: dereferencing pointer to incomplete type ‘struct ucontext’
     #define PC_sig(context)       ((context)->uc_mcontext.gregs[REG_RIP])
                                             ^
    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:232:10: note: in expansion of macro ‘PC_sig’
         pc = PC_sig(uc);
              ^~~~~~
    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/user-exec.c:237:1: warning: control reaches end of non-void function [-Wreturn-type]
     }
     ^
    /tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu/rules.mak:57: recipe for target 'user-exec.o' failed
    make[2]: *** [user-exec.o] Error 1
    make[2]: *** Waiting for unfinished jobs....
    Makefile:173: recipe for target 'subdir-i386-linux-user' failed
    make[1]: *** [subdir-i386-linux-user] Error 2
    make[1]: Leaving directory '/tmp/pip-90sh6mfp-build/bin/afl-multi-cgc/afl/qemu_mode/multicb-qemu'
    Makefile:2: recipe for target 'all' failed
    make: *** [all] Error 1
    error: Unable to make afl-multi-cgc
rhelmot commented 5 years ago

As I said before: you need to use the py3k branch.

awakened1712 commented 5 years ago

I see, I missed the py3k branch part. I didn't see any branch other than master in https://github.com/shellphish/shellphish-afl though. Do I miss anything else?

rhelmot commented 5 years ago

...I'm sorry, I forgot entirely which repository this issue was on. Here's a better explanation of your problem.

The issue isn't with shellphish-afl: that error message is from trying to build qemu, specifically the shellphish-qemu package, since shellphish-afl lists shellphish-qemu as a dependency. I fixed that, and it's present on the master branch of the shellphish-qemu repository, but I didn't put it up on pypi so when pip tried to resolve the dependency automatically it got the wrong version.

I've fixed this. Your command from the first post should work fine, or you can use this wheel.

@zardus can you please give me access to the shellphish_afl package on pip so I can upload the wheel