[Skiboot] skiboot + AFL fuzz test for 'libstb' unit tests

Stewart Smith stewart at linux.vnet.ibm.com
Wed Oct 26 18:18:53 AEDT 2016


rnsastry <rnsastry at linux.vnet.ibm.com> writes:
> I am trying to do fuzz test with American Fuzzy Lop (AFL) on 
> ‘libstb’ unit tests.
>
> Here is what I am trying,
>
> On a Ubuntu 16.04 guest running on Mac.
>
> AFL Setup:
> apt-get install build-essential wget git llvm clang flex bison
> mkdir $HOME/afl
> cd $HOME/afl
> wget -N http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
> tar xz afl-latest.tgz
> make
> cd llvm_mode
> make
>
> skiboot Setup:
> git clone https://github.com/open-power/skiboot
> cd skiboot
> make HOSTCC=$HOME/afl/afl-clang-fast        # this built all the 
> binaries, except 'extract-gcov’.
> make check CC=$HOME/afl/afl-clang-fast       # Here have to use CC, with 
> HOSTCC make check didn’t work.
>
> make check couldn’t compile the following. But compiled ‘libstb’ 
> unit tests. So proceeding further.
> ...
> ~skiboot/test/hello_world/Makefile.check:21: recipe for target 
> 'test/hello_world/hello_kernel/hello_kernel.o' failed
> make: *** [test/hello_world/hello_kernel/hello_kernel.o] Error 1

So, for 'make check' it also uses HOSTCC, as we build a couple of things
for the target for tests, one of them being the best Operating System OF
ALL TIME, the hello_kernel.

So you'll need to pass HOSTCC to 'make check' to get the unit tests
built using that compiler.

> Run AFL:
> I want to run ‘libstb' unit test named 'print-stb-container’, for 
> this a container file need to be passed as argument.
>
> Created /tmp/in and /tmp/out directories required for AFL as input and 
> output.
> Copied ‘cappubin’ container files to /tmp/in
>
> Tried running afl using the following command,
> $HOME/afl/afl-fuzz -i /tmp/in -o /tmp/out -- 
> libstb/test/print-stb-container @@
>
> but this throws error
> [-] PROGRAM ABORT : No instrumentation detected
>
> am I missing some thing to instrument ‘print-stb-container’?

It'll be that HOSTCC thing.

-- 
Stewart Smith
OPAL Architect, IBM.



More information about the Skiboot mailing list