linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Alexander Potapenko <glider@google.com>
Cc: Ethan Graham <ethan.w.s.graham@gmail.com>,
	ethangraham@google.com,  andreyknvl@gmail.com,
	brendan.higgins@linux.dev, davidgow@google.com,
	 dvyukov@google.com, jannh@google.com, elver@google.com,
	rmoar@google.com,  shuah@kernel.org, tarasmadan@google.com,
	kasan-dev@googlegroups.com,  kunit-dev@googlegroups.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
		dhowells@redhat.com, lukas@wunner.de, ignat@cloudflare.com,
		herbert@gondor.apana.org.au, davem@davemloft.net,
	linux-crypto@vger.kernel.org
Subject: Re: [PATCH v2 RFC 0/7] KFuzzTest: a new kernel fuzzing framework
Date: Thu, 11 Sep 2025 15:59:50 +0200	[thread overview]
Message-ID: <cf3eef898266e5a8064c6cc5d2c12a9b0971f75c.camel@sipsolutions.net> (raw)
In-Reply-To: <6eda1208c08130e00cb54e557bc4858ce10a4a94.camel@sipsolutions.net>

Hi again :-)

So I've been spending another day on this, looking at kafl/nyx as
promised, and thinking about afl++ integration.

> I've been looking also at broader fuzzing tools such as nyx-fuzz and
> related kafl [1] which are cool in theory (and are intended to address
> your "cannot fork VMs quickly enough" issue), but ... while running a
> modified host kernel etc. is sufficient for research, it's practically
> impossible for deploying things since you have to stay on top of
> security etc.
> 
> [1] https://intellabs.github.io/kAFL/tutorials/linux/fuzzing_linux_kernel.html
> 
> That said, it seems to me that upstream kvm code actually has Intel-PT
> support and also dirty page logging (presumably for VM migration), so
> I'm not entirely sure what the nyx/kafl host kernel actually really
> adds. But I have yet to research this in detail, I've now asked some
> folks at Intel who work(ed) on it.

It's actually a bit more nuanced - it can work without Intel-PT using
instrumentation for feedback and using the upstream kvm PML APIs, but
then it requires the "vmware backdoor" enabled.

Also, the qemu they have is based on version 4.2, according to the bug
tracker there were two failed attempts at forward-porting it.


> Which I'm not arguing is bad, quite the opposite, but I'm also close to
> just giving up on the whole UML thing precisely _because_ of it, since
> there's no way anyone can compete with Google's deployment, and adding
> somewhat competing infrastructure to the kernel will just complicate
> matters. Which is maybe unfortunate, because a fork/fuzz model often
> seems more usable in practice, and in particular can also be used more
> easily for regression tests.

Or maybe not given the state of the kafl/nyx world... :)

I also just spent a bunch of time looking at integrating afl++ with kcov
and it seems ... tricky? There seem to be assumptions on the data format
in afl++, but the kcov data format is entirely different, both for block
and compare tracking. I think it could be made to work most easily by
first supporting -fsanitize-coverage=trace-pc-guard in kcov (which is
clang only at this point), and adding a new KCOV_TRACE_ mode for it, one
that indexes by guard pointer and assigns incrementing numbers to those
like afl does, or so?

I'd think it'd be useful to also be able to run afl++ on the kfuzztests
proposed here by forwarding the kcov data. For this though, it seems it
might also be useful to actually wait for remote kcov to finish? Yeah
there's still the whole state issue, but at least (remote) kcov will
only trace code that's actually relevant to the injected data. This
would be with afl running as a normal userspace process against the
kfuzztest of the kernel it's running in, but with some additional setup
it'd also be possible to apply it to UML with forking to avoid state
issues.

(And yes, kcov seems to work fine on UML.)

I guess I'll go play with this some unless someone sees total show-
stoppers.

johannes


      reply	other threads:[~2025-09-11 14:00 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-01 16:42 [PATCH v2 RFC 0/7] KFuzzTest: a new kernel fuzzing framework Ethan Graham
2025-09-01 16:42 ` [PATCH v2 RFC 1/7] mm/kasan: implement kasan_poison_range Ethan Graham
2025-09-05  8:32   ` Alexander Potapenko
2025-09-05  8:46     ` Ethan Graham
2025-09-05  9:32       ` Alexander Potapenko
2025-09-01 16:42 ` [PATCH v2 RFC 2/7] kfuzztest: add user-facing API and data structures Ethan Graham
2025-09-02 10:37   ` Marco Elver
2025-09-03  8:40   ` Alexander Potapenko
2025-09-03 10:15   ` Alexander Potapenko
2025-09-03 11:35   ` Alexander Potapenko
2025-09-01 16:42 ` [PATCH v2 RFC 3/7] kfuzztest: implement core module and input processing Ethan Graham
2025-09-03  9:53   ` Alexander Potapenko
2025-09-01 16:42 ` [PATCH v2 RFC 4/7] tools: add kfuzztest-bridge utility Ethan Graham
2025-09-03 14:07   ` Alexander Potapenko
2025-09-05 10:43   ` Alexander Potapenko
2025-09-01 16:42 ` [PATCH v2 RFC 5/7] kfuzztest: add ReST documentation Ethan Graham
2025-09-04  8:53   ` Alexander Potapenko
2025-09-01 16:42 ` [PATCH v2 RFC 6/7] kfuzztest: add KFuzzTest sample fuzz targets Ethan Graham
2025-09-04  9:59   ` Alexander Potapenko
2025-09-01 16:42 ` [PATCH v2 RFC 7/7] crypto: implement KFuzzTest targets for PKCS7 and RSA parsing Ethan Graham
2025-09-03  8:58   ` Ignat Korchagin
2025-09-04 20:20     ` Ethan Graham
2025-09-04  9:11 ` [PATCH v2 RFC 0/7] KFuzzTest: a new kernel fuzzing framework David Gow
2025-09-04 20:08   ` Ethan Graham
2025-09-08 13:11 ` Johannes Berg
2025-09-10 10:40   ` Alexander Potapenko
2025-09-10 15:59     ` Johannes Berg
2025-09-11 13:59       ` Johannes Berg [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf3eef898266e5a8064c6cc5d2c12a9b0971f75c.camel@sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=andreyknvl@gmail.com \
    --cc=brendan.higgins@linux.dev \
    --cc=davem@davemloft.net \
    --cc=davidgow@google.com \
    --cc=dhowells@redhat.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=ethan.w.s.graham@gmail.com \
    --cc=ethangraham@google.com \
    --cc=glider@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@cloudflare.com \
    --cc=jannh@google.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=kunit-dev@googlegroups.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lukas@wunner.de \
    --cc=rmoar@google.com \
    --cc=shuah@kernel.org \
    --cc=tarasmadan@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).