You ran yum update kernel or apt upgrade linux-image, saw the transaction complete, and moved on. Weeks later someone asks: is CVE-2022-0847 (Dirty Pipe) actually fixed on that box? You check uname -r and see a version number that looks recent. But that alone proves nothing. The installed package might be patched while the running kernel is still the old one (no reboot happened), or the running kernel might be a custom build that never included the fix. Here is how to verify the patch is active on the system that is running right now.
What Dirty Pipe actually broke
CVE-2022-0847 is a local privilege escalation flaw in how the Linux kernel initializes pipe buffer flags. When the splice syscall moved data from a file into a pipe, the kernel failed to clear the PIPE_BUF_FLAG_CAN_MERGE flag on newly allocated pipe buffers. An unprivileged user could exploit this to overwrite the contents of read-only files cached in the page cache, including things like /usr/bin/su or /etc/passwd, and escalate to root.
The fix is small: the kernel now zeros out the flags field when allocating pipe buffers, so PIPE_BUF_FLAG_CAN_MERGE is never set on a fresh buffer that came from a splice. Every major distribution shipped patched kernels shortly after disclosure. The question is whether your running system is actually using one of those patched kernels.
Step 1: Compare running kernel to installed kernel
First, check what kernel is running:
uname -r
Then check what kernel packages are installed. On RHEL/CentOS/AlmaLinux:
rpm -qa | grep kernel | sort
On Debian/Ubuntu:
dpkg -l | grep linux-image
If the installed package version is newer than what uname -r reports, the system was upgraded but never rebooted. The old, potentially vulnerable kernel is still running. No amount of package-level verification matters until you reboot into the patched kernel.
This is the single most common reason a kernel patch "doesn't work." Support engineers see it regularly: the admin ran the update, confirmed the package is installed, but skipped the reboot. On a shared hosting node or a production VPS host, scheduling that reboot is inconvenient, so it gets postponed indefinitely.
For a deeper look at why uname -r alone is insufficient for confirming kernel LPE patches, there is a related walkthrough here: Thinking uname -r Proves You're Patched Against a Kernel LPE? Check the Changelog.
Step 2: Check the changelog for CVE-2022-0847
Once you confirm the running kernel version matches the installed package, inspect whether that package version actually contains the Dirty Pipe fix. Distribution vendors backport security patches without changing the upstream version number, so a kernel reporting 5.4.x might or might not include the fix depending on the distro's patch set.
On RHEL-family systems:
rpm -q --changelog kernel-$(uname -r) | grep -i 'CVE-2022-0847'
On Debian/Ubuntu, changelogs live in a different place:
zgrep -i 'CVE-2022-0847' /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
If the CVE ID appears in the changelog, the package maintainer included the fix. If it does not appear, either the kernel predates the fix, or the changelog format on your distro does not reference CVEs by ID (some custom or third-party kernels skip this). In that case, move to step 3.
One side note: if your uname -r output ends with -dirty or a + suffix, that typically means the kernel was compiled from a source tree with uncommitted modifications. It has nothing to do with the Dirty Pipe vulnerability itself. It is a build-system flag indicating the source was modified from the tagged release.
Step 3: Verify splice behavior without running an exploit
Running actual exploit code on a production system is a bad idea. If the system is vulnerable, you just escalated privileges for real. If it is not, you still triggered security monitoring alerts for no reason. Instead, verify the fix indirectly by checking how the kernel handles pipe buffer flags after a splice.
The safe approach: write a minimal C program that splices a small amount of data from a file into a pipe, then inspects whether writing to the pipe can modify the source file's page cache. The key difference between vulnerable and patched kernels:
- Vulnerable: after
splice(), the pipe buffer retainsPIPE_BUF_FLAG_CAN_MERGE, so a subsequentwrite()to the pipe overwrites the page cache. - Patched: the flag is cleared, so a
write()to the pipe allocates a new buffer instead of merging into the cached page.
A safe test does not attempt to overwrite a system binary. Instead, create a temporary test file, splice from it, write to the pipe, then read the original file back to see if it changed.
Here is the verification logic (create a file called check_dirtypipe.c):
// Safe CVE-2022-0847 verification - read-only check against a temp file
// Compile: gcc -o check_dirtypipe check_dirtypipe.c
// Run as unprivileged user, NOT as root
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
int main() {
// Create a temp file with known content
char template[] = "/tmp/dptest_XXXXXX";
int fd = mkstemp(template);
if (fd < 0) { perror("mkstemp"); return 1; }
// Write more than one page so splice has something to work with
char original[] = "AAAAAAAAAAAAAAAA";
write(fd, original, sizeof(original) - 1);
lseek(fd, 0, SEEK_SET);
// Set up a pipe
int pipefd[2];
if (pipe(pipefd) < 0) { perror("pipe"); return 1; }
// Fill and drain the pipe to cycle through buffers
// (the vulnerability requires reused pipe buffers)
unsigned pipe_size = fcntl(pipefd[1], F_GETPIPE_SZ);
char *buf = malloc(pipe_size);
memset(buf, 'B', pipe_size);
write(pipefd[1], buf, pipe_size);
read(pipefd[0], buf, pipe_size);
// Splice one byte from the file into the pipe
loff_t offset = 1; // skip first byte
ssize_t spliced = splice(fd, &offset, pipefd[1], NULL, 1, 0);
if (spliced < 0) { perror("splice"); return 1; }
// Attempt to write into the pipe (this is where the bug triggers)
char overwrite[] = "HACKED";
write(pipefd[1], overwrite, sizeof(overwrite) - 1);
// Now read the original file and check if it was modified
lseek(fd, 0, SEEK_SET);
char readback[64] = {0};
read(fd, readback, sizeof(readback) - 1);
close(fd);
close(pipefd[0]);
close(pipefd[1]);
if (strstr(readback, "HACKED")) {
printf("VULNERABLE: file content was modified via pipe write.\
");
printf("File content: %s\
", readback);
} else {
printf("PATCHED: file content unchanged. CVE-2022-0847 fix is active.\
");
printf("File content: %s\
", readback);
}
unlink(template);
free(buf);
return 0;
}
Compile and run as a normal (non-root) user:
gcc -o check_dirtypipe check_dirtypipe.c && ./check_dirtypipe
Expected output on a patched kernel:
# Illustrative output format
PATCHED: file content unchanged. CVE-2022-0847 fix is active.
File content: AAAAAAAAAAAAAAAA
On a vulnerable kernel, the file content would contain "HACKED" because the write to the pipe merged into the page cache and overwrote the temp file's data. This test is safe because it only targets a temporary file you own, not a system binary. Clean up the binary afterward: rm check_dirtypipe check_dirtypipe.c.
Important: run this as an unprivileged user. Running as root proves nothing because root can overwrite files anyway.
When the changelog is clean but the kernel is still old
Sometimes you find a system running a kernel that predates the fix, but the admin insists they patched it. Common causes:
- Multiple kernels installed, wrong one in GRUB default. Check
grubby --default-kernel(RHEL-family) orgrep GRUB_DEFAULT /etc/default/grub(Debian-family) to see which kernel boots by default. - Virtualization layer caching. On some VPS platforms, the hypervisor supplies the kernel, and updating packages inside the guest does nothing. Check whether your provider uses a host-managed kernel (common with older OpenVZ or some Proxmox LXC configurations). If so, the provider must update the host kernel.
- Custom-compiled kernels. If someone built the kernel from source, package manager changelogs will not exist. You need to check the source commit history or rely on the splice test above.
Broader context: kernel LPE is a pattern, not a one-time event
Dirty Pipe is one instance of a recurring class of Linux kernel local privilege escalation bugs. The page cache and pipe subsystem have had multiple issues over the years, and newer vulnerabilities in other subsystems (netfilter, crypto handlers, memory management) follow similar patterns: a local user exploits a logic flaw to write where they should not, then escalates to root.
The verification approach stays the same regardless of the specific CVE:
- Confirm the running kernel matches the installed, patched package.
- Search the changelog for the specific CVE ID.
- If possible, test the specific subsystem behavior safely.
- Reboot if the running kernel is older than the installed one.
For a comparison of how different kernel LPE mechanics affect your patching urgency, see: Dirty COW vs Copy Fail: Which Kernel LPE Mechanics Matter for Your Patch Decision?.
Beyond patching, reduce exposure to kernel LPE by limiting local access. Tighten SSH access, audit user accounts, restrict shell access on shared hosting nodes, and keep container runtimes updated. A kernel LPE requires local code execution first. If an attacker cannot get a shell, the kernel bug is unexploitable.
The short version
Three checks, in order: (1) uname -r matches the latest installed kernel package, meaning a reboot happened after the update. (2) The changelog for that package references CVE-2022-0847. (3) The splice test against a temp file confirms the pipe buffer flag fix is active. If any of these fail, the system is not protected, regardless of what the package manager says. Reboot into the patched kernel, re-run the checks, and move on.