[llvm-dev] A libc in LLVM

James Y Knight via llvm-dev llvm-dev at lists.llvm.org
Fri Jul 12 14:34:31 PDT 2019


On Fri, Jul 12, 2019 at 4:19 PM Szabolcs Nagy via llvm-dev <
llvm-dev at lists.llvm.org> wrote:

> > * Designed and developed from the start to work with LLVM tooling and
> > testing like fuzz testing and sanitizer-supported testing.
>
> the difficulty of this is not in the libc, but various
> issues in the sanitizer libraries.. e.g. you don't want to
> fuzz test a libc with a fuzz runtime that depends on a c++
> runtime (or any other external component that can call
> back to libc outside of the control of the fuzz runtime).
>

FWIW, I was able to fuzz-test some functions in musl using the AFL fuzzer
with only small changes (yes, this is not LLVM libFuzzer -- I haven't
gotten around to tryingthat yet). It required only minor modifications to
the musl makefile and to AFL.

The existing "NOSSP_OBJS" listed in the musl Makefile were exactly the
correct ones that needed to be excluded from fuzz coverage instrumentation.
I compiled the rest of the library with "afl-gcc", and those files with
plain "gcc".

Additionally, a 2-line change was needed in AFL to avoid trying to
recursively re-enter initialization while it was already in progress
(startup initialization calls getenv which then tries to call back into
initialization, because initialization hasn't completed yet). Other than
initialization, the instrumentation doesn't call back into libc, so just
suppressing that recursion is sufficient.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190712/68195da0/attachment.html>


More information about the llvm-dev mailing list