CVE-2025-21853: bpf: avoid holding freeze_mutex during mmap operation
In the Linux kernel, the following vulnerability has been resolved:
bpf: avoid holding freezemutex during mmap operation
We use map->freezemutex to prevent races between mapfreeze() and memory mapping BPF map contents with writable permissions. The way we naively do this means we'll hold freezemutex for entire duration of all the mm and VMA manipulations, which is completely unnecessary. This can potentially also lead to deadlocks, as reported by syzbot in [0].
So, instead, hold freezemutex only during writeability checks, bump (proactively) "write active" count for the map, unlock the mutex and proceed with mmap logic. And only if something went wrong during mmap logic, then undo that "write active" counter increment.
[0] https://lore.kernel.org/bpf/678dcbc9.050a0220.303755.0066.GAE@google.com/
Other sources
In the Linux kernel, the following vulnerability has been resolved:
bpf: avoid holding freezemutex during mmap operation
We use map-freezemutex to prevent races between mapfreeze() and memory mapping BPF map contents with writable permissions. The way we naively do this means we'll hold freezemutex for entire duration of all the mm and VMA manipulations, which is completely unnecessary. This can potentially also lead to deadlocks, as reported by syzbot in [0].
So, instead, hold freezemutex only during writeability checks, bump (proactively) "write active" count for the map, unlock the mutex and proceed with mmap logic. And only if something went wrong during mmap logic, then undo that "write active" counter increment.
[0]
— IBM
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-21853?
CVE-2025-21853 has been classified as having a moderate severity level.
How do I fix CVE-2025-21853?
To fix CVE-2025-21853, update your Linux kernel to the latest version that addresses this vulnerability.
What are the potential impacts of CVE-2025-21853?
CVE-2025-21853 may allow for race conditions during memory mapping of BPF map contents, potentially leading to information leakage or system instability.
Which versions of the Linux kernel are affected by CVE-2025-21853?
CVE-2025-21853 affects certain versions of the Linux kernel prior to the patch being applied.
Is there a detailed technical explanation for CVE-2025-21853?
CVE-2025-21853 involves an issue with the freeze_mutex during mmap operations in BPF, leading to potential race conditions.