# A gentle introduction to Linux Kernel fuzzing

DevFeed: [A gentle introduction to Linux Kernel fuzzing](<https://devfeed.tech/articles/a-gentle-introduction-to-linux-kernel-fuzzing-38986.md>)

Original publisher: [Read original article](<https://idea.popcount.org/2019-07-10-a-gentle-introduction-to-linux-kernel-fuzzing>)

Author: Marek

Published: 2019-07-09T22:00:00Z

Content type: tutorial

Language: en

Sources: [Marek Majkowski](<https://devfeed.tech/sources/marek-majkowski.md>)

Topics: [Fuzzing/Fuzz testing](<https://devfeed.tech/topics/fuzzing.md>), [Linux Kernel](<https://devfeed.tech/topics/linux-kernel.md>), [Instrumentation](<https://devfeed.tech/topics/instrumentation.md>), [Linux](<https://devfeed.tech/topics/linux.md>), [Software Testing](<https://devfeed.tech/topics/software-testing.md>), [Memory Safety](<https://devfeed.tech/topics/memory-safety.md>), [Network](<https://devfeed.tech/topics/network.md>)

Tags: [afl](<https://devfeed.tech/tags/afl.md>), [algorithm](<https://devfeed.tech/tags/algorithm.md>), [article](<https://devfeed.tech/tags/article.md>), [basic](<https://devfeed.tech/tags/basic.md>), [blog](<https://devfeed.tech/tags/blog.md>), [bugs](<https://devfeed.tech/tags/bugs.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [cloudflare](<https://devfeed.tech/tags/cloudflare.md>), [code-coverage](<https://devfeed.tech/tags/code-coverage.md>), [coverage](<https://devfeed.tech/tags/coverage.md>), [fuzzing](<https://devfeed.tech/tags/fuzzing.md>), [introduction](<https://devfeed.tech/tags/introduction.md>), [kernel](<https://devfeed.tech/tags/kernel.md>), [linux](<https://devfeed.tech/tags/linux.md>), [linux-kernel](<https://devfeed.tech/tags/linux-kernel.md>), [memory](<https://devfeed.tech/tags/memory.md>), [memory-corruption](<https://devfeed.tech/tags/memory-corruption.md>), [testing](<https://devfeed.tech/tags/testing.md>), [trigger](<https://devfeed.tech/tags/trigger.md>)

## AI overview

The article gives a tutorial for fuzzing Linux kernel netlink code with AFL inside a KVM virtual machine. Since AFL normally needs instrumented userspace code, the tutorial builds a shim that reads AFL inputs, sends them through netlink, collects kernel coverage from KCOV, and maps instruction addresses into AFL's shared coverage map. It recommends selectively enabling KCOV for the network code, enabling KASAN to improve memory-corruption detection, and using virtme to run the custom kernel. The example starts with a single "hello world" corpus seed; after a day or two, this basic setup found a netlink neighbor-timer bug. The author contrasts native fuzzing, which can crash the host, and UML, which lacks KASAN, with KVM's isolation. The tutorial omits several implementation details and says the tests are not stable after a crash; better corpus design and tuning could improve results.

## Source excerpt

A gentle introduction to Linux Kernel fuzzing This article was first published on Cloudflare blog: For some time I've wanted to play with coverage-guided fuzzing. Fuzzing is a powerful testing technique where an automated program feeds semi-random inputs to a tested program. The intention is to find such inputs that trigger bugs. Fuzzing is especially useful in finding memory corruption bugs in C or C++ programs.