
Shell script that builds patched Ubuntu kernel .deb packages containing the upstream kfree_rcu fix for the IPv4 use-after-free CVE-2026-98432.
build-patched-kernel.sh builds Ubuntu kernel .deb packages that include the
upstream fix for CVE-2026-98432:
e3f33b0a1d89 "ipv4: free inet_opt and ireq_opt after an RCU grace period"
The bug is a use-after-free in ip_options_build(). One CPU can still be
sending a SYNACK while another frees the IPv4 options of a TCP socket. The fix
replaces two kfree() calls with kfree_rcu(), in net/ipv4/af_inet.c and
net/ipv4/tcp_ipv4.c.
uname -r if none
is given (e.g. 6.8.0-45-generic).deb-src repositories and installs the compiler and build tools.apt-get source. If the archive no longer has that version, it falls back
to pull-lp-source from Launchpad. It then installs the build dependencies.kfree_rcu() doesn't accept NULL, it adds
a NULL check.+cve202698432.1 to the package version, so the new packages
upgrade the archive packages with the same ABI.debian/rules and copies the .deb files to
./debs-<version>/.Running the script again reuses the downloaded sources and doesn't patch them twice.
On the Ubuntu machine itself (run as root or with sudo):
./build-patched-kernel.sh # kernel from uname -r
./build-patched-kernel.sh 6.8.0-45-generic # a specific kernel
In Docker, use the Ubuntu release that matches the kernel (noble for 6.8,
jammy for 5.15). Pass the version explicitly, because uname -r inside a
container shows the host's kernel:
docker run --rm -v "$PWD":/work -w /work -e WORKDIR=/build ubuntu:24.04 \
./build-patched-kernel.sh 6.8.0-45-generic
WORKDIR=/build keeps the kernel sources inside the container. You need this
when the mounted directory is case-insensitive, as on macOS. Other settings
(OUTDIR, LOCAL_SUFFIX, SRC_PACKAGE/SRC_VERSION, JOBS) are described
at the top of the script.
sudo apt install ./debs-<version>/linux-image-unsigned-<version>_*.deb \
./debs-<version>/linux-modules-<version>_*.deb \
./debs-<version>/linux-modules-extra-<version>_*.deb \
./debs-<version>/linux-headers-*.deb
sudo reboot
The kernel image is unsigned and replaces the signed linux-image-<version>
package. If Secure Boot is on, either sign the image with your own MOK key or
turn Secure Boot off.