CVE-2026-99734: mm/shmem: make shmem_file() check the file's inode
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
mm/shmem: make shmem_file() check the file's inode
shmem_file() only checks if file->f_mapping is a shmem mapping. This mapping can belong to another file, however, as with a Coda file backed by a tmpfs container after mmap().
So it does not guarantee that the file inode is an actual shmem inode.
Seal handling and memfd preservation use this check before accessing shmem inode state, so they can access an inode of the wrong type.
Let's make shmem_file() check the inode's file operations instead, to identify shmem inodes reliably. This will identify regular shmem inodes, including memfds and ordinary tmpfs files, independently of wrapper file operations.
Use shmem_mapping() in collapse_file() instead to not change the behavior of collapse_file(): it operates on the page cache and uses mapping->host for shmem inode operations. Focusing on the file does not seem relevant.
The Linux kernel CVE team has assigned CVE-2026-99734 to this issue.
Affected and fixed versions
===========================
Issue introduced in 4.18 with commit c49fcfcda8b5b06529103664f0291f433f5e6d24 and fixed in 7.3.5 with commit ea5cc241113f7820ce037dbcf8b7eb959fbf1c0d Issue introduced in 4.18 with commit c49fcfcda8b5b06529103664f0291f433f5e6d24 and fixed in 7.4-rc2 with commit d3710111839d11339e414b1bb3fea3d05ab83f6e
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2026-99734
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
include/linux/shmem_fs.h
mm/khugepaged.c
mm/shmem.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/ea5cc241113f7820ce037dbcf8b7eb959fbf1c0d https://git.kernel.org/stable/c/d3710111839d11339e414b1bb3fea3d05ab83f6e