CVE-2021-47089
Severity CVSS v4.0:
Pending analysis
Type:
Unavailable / Other
Publication date:
04/03/2024
Last modified:
04/04/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
kfence: fix memory leak when cat kfence objects<br />
<br />
Hulk robot reported a kmemleak problem:<br />
<br />
unreferenced object 0xffff93d1d8cc02e8 (size 248):<br />
comm "cat", pid 23327, jiffies 4624670141 (age 495992.217s)<br />
hex dump (first 32 bytes):<br />
00 40 85 19 d4 93 ff ff 00 10 00 00 00 00 00 00 .@..............<br />
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................<br />
backtrace:<br />
seq_open+0x2a/0x80<br />
full_proxy_open+0x167/0x1e0<br />
do_dentry_open+0x1e1/0x3a0<br />
path_openat+0x961/0xa20<br />
do_filp_open+0xae/0x120<br />
do_sys_openat2+0x216/0x2f0<br />
do_sys_open+0x57/0x80<br />
do_syscall_64+0x33/0x40<br />
entry_SYSCALL_64_after_hwframe+0x44/0xa9<br />
unreferenced object 0xffff93d419854000 (size 4096):<br />
comm "cat", pid 23327, jiffies 4624670141 (age 495992.217s)<br />
hex dump (first 32 bytes):<br />
6b 66 65 6e 63 65 2d 23 32 35 30 3a 20 30 78 30 kfence-#250: 0x0<br />
30 30 30 30 30 30 30 37 35 34 62 64 61 31 32 2d 0000000754bda12-<br />
backtrace:<br />
seq_read_iter+0x313/0x440<br />
seq_read+0x14b/0x1a0<br />
full_proxy_read+0x56/0x80<br />
vfs_read+0xa5/0x1b0<br />
ksys_read+0xa0/0xf0<br />
do_syscall_64+0x33/0x40<br />
entry_SYSCALL_64_after_hwframe+0x44/0xa9<br />
<br />
I find that we can easily reproduce this problem with the following<br />
commands:<br />
<br />
cat /sys/kernel/debug/kfence/objects<br />
echo scan > /sys/kernel/debug/kmemleak<br />
cat /sys/kernel/debug/kmemleak<br />
<br />
The leaked memory is allocated in the stack below:<br />
<br />
do_syscall_64<br />
do_sys_open<br />
do_dentry_open<br />
full_proxy_open<br />
seq_open ---> alloc seq_file<br />
vfs_read<br />
full_proxy_read<br />
seq_read<br />
seq_read_iter<br />
traverse ---> alloc seq_buf<br />
<br />
And it should have been released in the following process:<br />
<br />
do_syscall_64<br />
syscall_exit_to_user_mode<br />
exit_to_user_mode_prepare<br />
task_work_run<br />
____fput<br />
__fput<br />
full_proxy_release ---> free here<br />
<br />
However, the release function corresponding to file_operations is not<br />
implemented in kfence. As a result, a memory leak occurs. Therefore,<br />
the solution to this problem is to implement the corresponding release<br />
function.
Impact
Base Score 3.x
3.30
Severity 3.x
LOW
Vulnerable products and versions
CPE | From | Up to |
---|---|---|
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.12 (including) | 5.15.12 (excluding) |
cpe:2.3:o:linux:linux_kernel:5.16:rc1:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:5.16:rc2:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:5.16:rc3:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:5.16:rc4:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:5.16:rc5:*:*:*:*:*:* | ||
cpe:2.3:o:linux:linux_kernel:5.16:rc6:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page