In the Linux kernel, the following vulnerability has been resolved:
nfsd: cancel nfsdshrinkerwork using sync mode in nfs4stateshutdown_net
In the normal case, when we excute echo 0 > /proc/fs/nfsd/threads, the
function nfs4_state_destroy_net in nfs4_state_shutdown_net will
release all resources related to the hashed nfs4_client. If the
nfsd_client_shrinker is running concurrently, the expire_client
function will first unhash this client and then destroy it. This can
lead to the following warning. Additionally, numerous use-after-free
errors may occur as well.
nfsdclientshrinker echo 0 > /proc/fs/nfsd/threads
expireclient nfsdshutdownnet unhashclient ... nfs4stateshutdownnet /* won't wait shrinker exit */ /* cancelwork(&nn->nfsdshrinkerwork) * nfsdfile for this /* won't destroy unhashed client1 */ * client1 still alive nfs4statedestroynet */
nfsd_file_cache_shutdown
/* trigger warning */
kmem_cache_destroy(nfsd_file_slab)
kmem_cache_destroy(nfsd_file_mark_slab)
/* release nfsdfile and mark */ _destroy_client
==================================================================== BUG nfsdfile (Not tainted): Objects remaining in nfsdfile on
CPU: 4 UID: 0 PID: 764 Comm: sh Not tainted 6.12.0-rc3+ #1
dumpstacklvl+0x53/0x70 slaberr+0xb0/0xf0 _kmemcacheshutdown+0x15c/0x310 kmemcachedestroy+0x66/0x160 nfsdfilecacheshutdown+0xac/0x210 [nfsd] nfsddestroyserv+0x251/0x2a0 [nfsd] nfsdsvc+0x125/0x1e0 [nfsd] writethreads+0x16a/0x2a0 [nfsd] nfsctltransactionwrite+0x74/0xa0 [nfsd] vfswrite+0x1a5/0x6d0 ksyswrite+0xc1/0x160 dosyscall64+0x5f/0x170 entrySYSCALL64after_hwframe+0x76/0x7e
==================================================================== BUG nfsdfilemark (Tainted: G B W ): Objects remaining
dumpstacklvl+0x53/0x70 slaberr+0xb0/0xf0 _kmemcacheshutdown+0x15c/0x310 kmemcachedestroy+0x66/0x160 nfsdfilecacheshutdown+0xc8/0x210 [nfsd] nfsddestroyserv+0x251/0x2a0 [nfsd] nfsdsvc+0x125/0x1e0 [nfsd] writethreads+0x16a/0x2a0 [nfsd] nfsctltransactionwrite+0x74/0xa0 [nfsd] vfswrite+0x1a5/0x6d0 ksyswrite+0xc1/0x160 dosyscall64+0x5f/0x170 entrySYSCALL64after_hwframe+0x76/0x7e
To resolve this issue, cancel nfsd_shrinker_work using synchronous
mode in nfs4stateshutdown_net.
[
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f965dc0f099a54fca100acf6909abe52d0c85328",
"id": "CVE-2024-50121-1d25a42e",
"digest": {
"line_hashes": [
"169545521002908396830072499828180045779",
"100586876307347461148900291953824179075",
"247105504362864633066132704492653056555",
"34484962630249483339394985565885139520"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"target": {
"file": "fs/nfsd/nfs4state.c"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@add1df5eba163a3a6ece11cb85890e2e410baaea",
"id": "CVE-2024-50121-1e6194cc",
"digest": {
"line_hashes": [
"309128401169417009582413092835631281921",
"202892085294998761872815655356407253968",
"53607418604884438757545296437553190872",
"34484962630249483339394985565885139520"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"target": {
"file": "fs/nfsd/nfs4state.c"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f67138dd338cb564ade7d3755c8cd4f68b46d397",
"id": "CVE-2024-50121-1f073223",
"digest": {
"line_hashes": [
"169545521002908396830072499828180045779",
"100586876307347461148900291953824179075",
"247105504362864633066132704492653056555",
"34484962630249483339394985565885139520"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"target": {
"file": "fs/nfsd/nfs4state.c"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@36775f42e039b01d4abe8998bf66771a37d3cdcc",
"id": "CVE-2024-50121-9799dbe4",
"digest": {
"line_hashes": [
"169545521002908396830072499828180045779",
"100586876307347461148900291953824179075",
"247105504362864633066132704492653056555",
"34484962630249483339394985565885139520"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"target": {
"file": "fs/nfsd/nfs4state.c"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@5ade4382de16c34d9259cb548f36ec5c4555913c",
"id": "CVE-2024-50121-a8771dc0",
"digest": {
"line_hashes": [
"169545521002908396830072499828180045779",
"100586876307347461148900291953824179075",
"247105504362864633066132704492653056555",
"34484962630249483339394985565885139520"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"target": {
"file": "fs/nfsd/nfs4state.c"
}
},
{
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@d5ff2fb2e7167e9483846e34148e60c0c016a1f6",
"id": "CVE-2024-50121-f18f598f",
"digest": {
"line_hashes": [
"309128401169417009582413092835631281921",
"202892085294998761872815655356407253968",
"53607418604884438757545296437553190872",
"34484962630249483339394985565885139520"
],
"threshold": 0.9
},
"signature_version": "v1",
"deprecated": false,
"signature_type": "Line",
"target": {
"file": "fs/nfsd/nfs4state.c"
}
}
]