fuzzer icon indicating copy to clipboard operation
fuzzer copied to clipboard

Installation error

Open awakened1712 opened this issue 6 years ago • 5 comments

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?

awakened1712 avatar Sep 12 '18 09:09 awakened1712

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.

rhelmot avatar Sep 12 '18 11:09 rhelmot

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

awakened1712 avatar Sep 13 '18 02:09 awakened1712

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

rhelmot avatar Sep 13 '18 02:09 rhelmot

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?

awakened1712 avatar Sep 13 '18 05:09 awakened1712

...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

rhelmot avatar Sep 13 '18 05:09 rhelmot