linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Jiakai Xu <jiakaipeanut@gmail.com>
To: Ethan Graham <ethan.w.s.graham@gmail.com>
Cc: akpm@linux-foundation.org, andreyknvl@gmail.com,
	andy.shevchenko@gmail.com,  andy@kernel.org, brauner@kernel.org,
	brendan.higgins@linux.dev,  davem@davemloft.net,
	davidgow@google.com, dhowells@redhat.com,  dvyukov@google.com,
	ebiggers@kernel.org, elver@google.com, glider@google.com,
	 gregkh@linuxfoundation.org, herbert@gondor.apana.org.au,
	ignat@cloudflare.com,  jack@suse.cz, jannh@google.com,
	johannes@sipsolutions.net,  kasan-dev@googlegroups.com,
	kees@kernel.org, kunit-dev@googlegroups.com,
	 linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	 linux-mm@kvack.org, lukas@wunner.de, mcgrof@kernel.org,
	rmoar@google.com,  shuah@kernel.org, sj@kernel.org,
	skhan@linuxfoundation.org,  tarasmadan@google.com,
	wentaoz5@illinois.edu
Subject: Re: Question about "stateless or low-state functions" in KFuzzTest doc
Date: Fri, 6 Mar 2026 19:04:02 +0800	[thread overview]
Message-ID: <CAFb8wJvmnPv96o9Kr9VAh=cL9zMr8-5eCEmmkjtgX02_Ypa4nw@mail.gmail.com> (raw)
In-Reply-To: <CANgxf6yMNZ3=xm9xVhPZDuxMc__7pQk=mti-CyD1QjUOgTJLEA@mail.gmail.com>

Hi Ethan,

Thanks for the detailed explanation.

Would it be fair to say that KFuzzTest is not well suited for testing
kernel functions that are heavily influenced by or have a significant
impact on kernel state?

I agree with your point that "the goal of the framework is to fuzz real
functions with realistic inputs." One thing I've been thinking about,
though, is how we determine what counts as "realistic" input for a given
function. If the generated inputs that a function would never actually
receive in practice, we'd likely end up chasing false-positive crashes
that don't represent real bugs.

Thanks,
Jiakai


On Fri, Mar 6, 2026 at 6:29 PM Ethan Graham <ethan.w.s.graham@gmail.com> wrote:
>
> On Fri, Mar 6, 2026 at 10:45 AM Jiakai Xu <jiakaipeanut@gmail.com> wrote:
> >
> > Hi Ethan and all,
>
> Hi Jiakai
>
> > I've been reading the KFuzzTest documentation patch (v4 3/6) with great
> > interest. I have some questions about the scope and applicability of this
> > framework that I'd like to discuss with the community.
> >
> > The documentation states:
> > > It is intended for testing stateless or low-state functions that are
> > > difficult to reach from the system call interface, such as routines
> > > involved in file format parsing or complex data transformations.
> >
> > I'm trying to better understand what qualifies as a "stateless or
> > low-state function" in the kernel context. How do we define or identify
> > whether a kernel function is stateless or low-state?
> >
> > Also, I'm curious - what proportion of kernel functions would we
> > estimate falls into this category?
>
> I would define it based on "practical heuristics". A function is probably a
> good candidate for KFuzzTest if it fits these loose criteria:
>
> - Minimal setup: KFuzzTest currently supports blob-based fuzzing, so the
>   function should consume raw data (or a thin wrapper struct) and not
>   require a complex web of pre-initialized objects or deep call-chain
>   prerequisites.
> - Manageable teardown: if the function allocates memory or creates
>   objects, the fuzzing harness must be able to cleanly free or revert
>   that state before the next iteration. An example of this can be found
>   in the pkcs7 example in patch 5/6 [1].
> - Non-destructive global impact: it's okay if the function touches global
>   state in minor ways (e.g., writing to the OID registry logs as is done
>   by the crypto/ functions that are fuzzed by the harnesses in patch 5/6),
>   but what matters is that the kernel isn't left in a broken state before the
>   next fuzzing iteration, meaning no leaked global locks, no corrupted
>   shared data structures, and no deadlocks.
>
> These loose criteria are just suggestions, as you can technically fuzz
> anything that you want to - KFuzzTest won't stop you. The danger is
> that the kernel isn't designed to have raw userspace inputs shoved
> into deep stateful functions out of nowhere. If a harness or function
> relies on complex ad-hoc state management or strict preconditions,
> fuzzing it out of context will likely just result in false positives, panics,
> and ultimately bogus harnesses.
>
> The goal of the framework is to fuzz real functions with realistic inputs
> without accidentally breaking other parts of the kernel that the function
> wasn't meant to touch. Therefore ideal targets (like the PKCS7 example)
> are ones with minimal setup (just passing a blob), have manageable
> teardown (like freeing a returned object on success) and don't
> destructively impact global state (even if they do minor things like
> printing to logs).
>
> That said, I'm curious to see what you come up with! I'm sure there are
> other use cases that I haven't thought of.
>
> [1] PKCS7 message parser fuzzing harness:
> https://lore.kernel.org/all/20260112192827.25989-6-ethan.w.s.graham@gmail.com/


  reply	other threads:[~2026-03-06 11:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 19:28 [PATCH v4 0/6] KFuzzTest: a new kernel fuzzing framework Ethan Graham
2026-01-12 19:28 ` [PATCH v4 1/6] kfuzztest: add user-facing API and data structures Ethan Graham
2026-01-20 13:23   ` Alexander Potapenko
2026-01-12 19:28 ` [PATCH v4 2/6] kfuzztest: implement core module and input processing Ethan Graham
2026-01-20 13:39   ` Alexander Potapenko
2026-01-12 19:28 ` [PATCH v4 3/6] kfuzztest: add ReST documentation Ethan Graham
2026-03-06  9:44   ` Question about "stateless or low-state functions" in KFuzzTest doc Jiakai Xu
2026-03-06 10:29     ` Ethan Graham
2026-03-06 11:04       ` Jiakai Xu [this message]
2026-03-06 16:53         ` Ethan Graham
2026-01-12 19:28 ` [PATCH v4 4/6] kfuzztest: add KFuzzTest sample fuzz targets Ethan Graham
2026-01-13  2:17   ` kernel test robot
2026-01-20 14:04   ` Alexander Potapenko
2026-01-12 19:28 ` [PATCH v4 5/6] crypto: implement KFuzzTest targets for PKCS7 and RSA parsing Ethan Graham
2026-01-12 19:28 ` [PATCH v4 6/6] MAINTAINERS: add maintainer information for KFuzzTest Ethan Graham
2026-01-20 14:12   ` Alexander Potapenko
2026-01-12 19:43 ` [PATCH v4 0/6] KFuzzTest: a new kernel fuzzing framework Ethan Graham
2026-01-14 12:28 ` Ethan Graham
2026-01-14 12:37   ` Johannes Berg
2026-01-20 14:26 ` Alexander Potapenko
2026-01-30 11:13   ` Alexander Potapenko

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='CAFb8wJvmnPv96o9Kr9VAh=cL9zMr8-5eCEmmkjtgX02_Ypa4nw@mail.gmail.com' \
    --to=jiakaipeanut@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@gmail.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=brauner@kernel.org \
    --cc=brendan.higgins@linux.dev \
    --cc=davem@davemloft.net \
    --cc=davidgow@google.com \
    --cc=dhowells@redhat.com \
    --cc=dvyukov@google.com \
    --cc=ebiggers@kernel.org \
    --cc=elver@google.com \
    --cc=ethan.w.s.graham@gmail.com \
    --cc=glider@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=ignat@cloudflare.com \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=johannes@sipsolutions.net \
    --cc=kasan-dev@googlegroups.com \
    --cc=kees@kernel.org \
    --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=mcgrof@kernel.org \
    --cc=rmoar@google.com \
    --cc=shuah@kernel.org \
    --cc=sj@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=tarasmadan@google.com \
    --cc=wentaoz5@illinois.edu \
    /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