CVE-2022-49148 in Linuxinfo

Summary

by MITRE • 02/26/2025

In the Linux kernel, the following vulnerability has been resolved:

watch_queue: Free the page array when watch_queue is dismantled

Commit 7ea1a0124b6d ("watch_queue: Free the alloc bitmap when the watch_queue is torn down") took care of the bitmap, but not the page array.

BUG: memory leak unreferenced object 0xffff88810d9bc140 (size 32): comm "syz-executor335", pid 3603, jiffies 4294946994 (age 12.840s) hex dump (first 32 bytes): 40 a7 40 04 00 ea ff ff 00 00 00 00 00 00 00 00 @.@............. 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: kmalloc_array include/linux/slab.h:621 [inline]
kcalloc include/linux/slab.h:652 [inline]
watch_queue_set_size+0x12f/0x2e0 kernel/watch_queue.c:251 pipe_ioctl+0x82/0x140 fs/pipe.c:632 vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:874 [inline]
__se_sys_ioctl fs/ioctl.c:860 [inline]
__x64_sys_ioctl+0xfc/0x140 fs/ioctl.c:860 do_syscall_x64 arch/x86/entry/common.c:50 [inline]

Be aware that VulDB is the high quality source for vulnerability data.

Analysis

by VulDB Data Team • 02/26/2025

The vulnerability identified as CVE-2022-49148 represents a memory leak within the Linux kernel's watch_queue subsystem, specifically affecting the proper cleanup of allocated resources during system shutdown or resource deallocation. This issue manifests when the watch_queue structure is dismantled, leaving behind allocated memory that should have been freed. The problem stems from an incomplete implementation in commit 7ea1a0124b6d which addressed the cleanup of the allocation bitmap but neglected to handle the corresponding page array cleanup. The memory leak occurs at the kernel level where kmalloc_array and kcalloc functions are used to allocate memory for the watch_queue structure, yet the page array remains unreferenced and unfreed when the system tears down the watch_queue. The vulnerability impacts kernel memory management and can lead to gradual memory consumption over time, potentially causing system instability or performance degradation. This type of memory leak represents a classic case of resource management failure where allocated kernel memory is not properly released, creating a persistent memory footprint that accumulates over system usage.

The technical flaw resides in the watch_queue subsystem's resource cleanup mechanism where the page array allocated during watch_queue initialization is not properly freed when the structure is torn down. This memory leak occurs in the kernel/watch_queue.c file at line 251 within the watch_queue_set_size function, where the kmalloc_array and kcalloc allocations are made but not properly cleaned up during subsequent deallocation. The system exhibits the memory leak through the kernel's memory management subsystem, where the unreferenced object appears to be 32 bytes in size and is associated with the syz-executor335 process that triggered the memory allocation. The backtrace clearly demonstrates the call path from the watch_queue_set_size function through pipe_ioctl to the final system call handler, showing how the memory leak originates from the ioctl interface used to manage pipe operations. This flaw directly relates to CWE-401, which describes improper resource cleanup or release, and specifically represents a memory leak in kernel space that violates proper memory management practices.

The operational impact of CVE-2022-49148 extends beyond simple memory consumption as it represents a persistent kernel-level resource leak that can accumulate over time and potentially lead to system instability or denial of service conditions. In environments where watch_queue operations are frequently performed, such as in containerized environments or systems with high I/O activity, the memory leak can compound and eventually consume significant portions of available kernel memory. The vulnerability affects systems running Linux kernels that include the specific commit mentioned in the patch, making it relevant to a wide range of kernel versions and deployment scenarios. The memory leak can also interfere with memory management subsystems, potentially causing memory fragmentation or triggering kernel memory allocation failures that could impact other system operations. Additionally, the vulnerability may be exploitable in certain contexts where memory exhaustion could be leveraged to cause system instability or denial of service attacks, particularly in virtualized environments where memory resources are more constrained.

Mitigation strategies for CVE-2022-49148 should focus on applying the appropriate kernel patches that properly implement cleanup of both the allocation bitmap and the page array within the watch_queue subsystem. System administrators should prioritize updating to kernel versions that include the fix for commit 7ea1a0124b6d, ensuring that both the bitmap and page array cleanup routines are properly implemented. In environments where immediate patching is not feasible, monitoring for memory usage patterns and implementing memory leak detection tools can help identify systems that may be affected by this vulnerability. The fix should ensure that when watch_queue structures are dismantled, all associated memory allocations including page arrays are properly freed through the kernel's memory management subsystem. Additionally, system administrators should consider implementing memory monitoring and alerting mechanisms to detect unusual memory consumption patterns that might indicate the presence of this vulnerability. The mitigation approach aligns with ATT&CK technique T1490 which involves resource hijacking through memory exhaustion, making proper kernel patching essential for maintaining system security and stability.

Responsible

Linux

Reservation

02/26/2025

Disclosure

02/26/2025

Moderation

accepted

CPE

ready

EPSS

0.00240

KEV

no

Activities

very low

Sources

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!