CVE-2024-50121
Severity CVSS v4.0:
Pending analysis
Type:
CWE-416
Use After Free
Publication date:
05/11/2024
Last modified:
03/11/2025
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
nfsd: cancel nfsd_shrinker_work using sync mode in nfs4_state_shutdown_net<br />
<br />
In the normal case, when we excute `echo 0 > /proc/fs/nfsd/threads`, the<br />
function `nfs4_state_destroy_net` in `nfs4_state_shutdown_net` will<br />
release all resources related to the hashed `nfs4_client`. If the<br />
`nfsd_client_shrinker` is running concurrently, the `expire_client`<br />
function will first unhash this client and then destroy it. This can<br />
lead to the following warning. Additionally, numerous use-after-free<br />
errors may occur as well.<br />
<br />
nfsd_client_shrinker echo 0 > /proc/fs/nfsd/threads<br />
<br />
expire_client nfsd_shutdown_net<br />
unhash_client ...<br />
nfs4_state_shutdown_net<br />
/* won&#39;t wait shrinker exit */<br />
/* cancel_work(&nn->nfsd_shrinker_work)<br />
* nfsd_file for this /* won&#39;t destroy unhashed client1 */<br />
* client1 still alive nfs4_state_destroy_net<br />
*/<br />
<br />
nfsd_file_cache_shutdown<br />
/* trigger warning */<br />
kmem_cache_destroy(nfsd_file_slab)<br />
kmem_cache_destroy(nfsd_file_mark_slab)<br />
/* release nfsd_file and mark */<br />
__destroy_client<br />
<br />
====================================================================<br />
BUG nfsd_file (Not tainted): Objects remaining in nfsd_file on<br />
__kmem_cache_shutdown()<br />
--------------------------------------------------------------------<br />
CPU: 4 UID: 0 PID: 764 Comm: sh Not tainted 6.12.0-rc3+ #1<br />
<br />
dump_stack_lvl+0x53/0x70<br />
slab_err+0xb0/0xf0<br />
__kmem_cache_shutdown+0x15c/0x310<br />
kmem_cache_destroy+0x66/0x160<br />
nfsd_file_cache_shutdown+0xac/0x210 [nfsd]<br />
nfsd_destroy_serv+0x251/0x2a0 [nfsd]<br />
nfsd_svc+0x125/0x1e0 [nfsd]<br />
write_threads+0x16a/0x2a0 [nfsd]<br />
nfsctl_transaction_write+0x74/0xa0 [nfsd]<br />
vfs_write+0x1a5/0x6d0<br />
ksys_write+0xc1/0x160<br />
do_syscall_64+0x5f/0x170<br />
entry_SYSCALL_64_after_hwframe+0x76/0x7e<br />
<br />
====================================================================<br />
BUG nfsd_file_mark (Tainted: G B W ): Objects remaining<br />
nfsd_file_mark on __kmem_cache_shutdown()<br />
--------------------------------------------------------------------<br />
<br />
dump_stack_lvl+0x53/0x70<br />
slab_err+0xb0/0xf0<br />
__kmem_cache_shutdown+0x15c/0x310<br />
kmem_cache_destroy+0x66/0x160<br />
nfsd_file_cache_shutdown+0xc8/0x210 [nfsd]<br />
nfsd_destroy_serv+0x251/0x2a0 [nfsd]<br />
nfsd_svc+0x125/0x1e0 [nfsd]<br />
write_threads+0x16a/0x2a0 [nfsd]<br />
nfsctl_transaction_write+0x74/0xa0 [nfsd]<br />
vfs_write+0x1a5/0x6d0<br />
ksys_write+0xc1/0x160<br />
do_syscall_64+0x5f/0x170<br />
entry_SYSCALL_64_after_hwframe+0x76/0x7e<br />
<br />
To resolve this issue, cancel `nfsd_shrinker_work` using synchronous<br />
mode in nfs4_state_shutdown_net.
Impact
Base Score 3.x
7.80
Severity 3.x
HIGH
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.10.220 (including) | 5.15 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.15.154 (including) | 6.1 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.2 (including) | 6.6.59 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 6.7 (including) | 6.11.6 (excluding) |
| cpe:2.3:o:linux:linux_kernel:6.12:rc1:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc2:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc3:*:*:*:*:*:* | ||
| cpe:2.3:o:linux:linux_kernel:6.12:rc4:*:*:*:*:*:* |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/36775f42e039b01d4abe8998bf66771a37d3cdcc
- https://git.kernel.org/stable/c/5ade4382de16c34d9259cb548f36ec5c4555913c
- https://git.kernel.org/stable/c/add1df5eba163a3a6ece11cb85890e2e410baaea
- https://git.kernel.org/stable/c/d5ff2fb2e7167e9483846e34148e60c0c016a1f6
- https://git.kernel.org/stable/c/f67138dd338cb564ade7d3755c8cd4f68b46d397
- https://git.kernel.org/stable/c/f965dc0f099a54fca100acf6909abe52d0c85328
- https://lists.debian.org/debian-lts-announce/2025/03/msg00001.html
- https://lists.debian.org/debian-lts-announce/2025/03/msg00002.html



