The flaw exists in the kernel's handling of MAP_SHARED pages when combined with specific fadvise flags. By forcing the kernel to drop its clean pages and then immediately writing to the mapped memory, an attacker can 'race' the kernel's internal write-back mechanism, effectively poisoning the cache for all subsequent readers of the file.
int fd = open('/etc/passwd', O_RDONLY);
void *addr = mmap(NULL, size, PROT_READ, MAP_SHARED, fd, 0);
// Trigger the 'Copy Fail' logic flaw
fadvise(fd, 0, size, POSIX_FADV_DONTNEED);
memcpy(addr, malicious_data, size);
// The kernel now serves 'malicious_data' from the page cache to all processes
The patch introduces a strict validation check during page-fault handling to ensure that memory-mapped writes do not bypass the standard filesystem permission checks, even when targeting the cache.