Vulnerability · Published Jul 29, 2024 · Assigned by Linux
CVE-2024-41058cachefiles: fix slab-use-after-free in fscache_withdraw_volume()
High 7.8
In plain English
A high-severity security flaw in Linux from Linux. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 0.3% (higher than 21% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
In the Linux kernel, the following vulnerability has been resolved: cachefiles: fix slab-use-after-free in fscache_withdraw_volume() We got the following issue in our fault injection stress test: ================================================================== BUG: KASAN: slab-use-after-free in fscache_withdraw_volume+0x2e1/0x370 Read of size 4 at addr ffff88810680be08 by task ondemand-04-dae/5798 CPU: 0 PID: 5798 Comm: ondemand-04-dae Not tainted 6.8.0-dirty #565 Call Trace: kasan_check_range+0xf6/0x1b0 fscache_withdraw_volume+0x2e1/0x370 cachefiles_withdraw_volume+0x31/0x50 cachefiles_withdraw_cache+0x3ad/0x900 cachefiles_put_unbind_pincount+0x1f6/0x250 cachefiles_daemon_release+0x13b/0x290 __fput+0x204/0xa00 task_work_run+0x139/0x230 Allocated by task 5820: __kmalloc+0x1df/0x4b0 fscache_alloc_volume+0x70/0x600 __fscache_acquire_volume+0x1c/0x610 erofs_fscache_register_volume+0x96/0x1a0 erofs_fscache_register_fs+0x49a/0x690 erofs_fc_fill_super+0x6c0/0xcc0 vfs_get_super+0xa9/0x140 vfs_get_tree+0x8e/0x300 do_new_mount+0x28c/0x580 [...] Freed by task 5820: kfree+0xf1/0x2c0 fscache_put_volume.part.0+0x5cb/0x9e0 erofs_fscache_unregister_fs+0x157/0x1b0 erofs_kill_sb+0xd9/0x1c0 deactivate_locked_super+0xa3/0x100 vfs_get_super+0x105/0x140 vfs_get_tree+0x8e/0x300 do_new_mount+0x28c/0x580 [...] ================================================================== Following is the process that triggers the issue: mount failed | daemon exit ------------------------------------------------------------ deactivate_locked_super cachefiles_daemon_release erofs_kill_sb erofs_fscache_unregister_fs fscache_relinquish_volume __fscache_relinquish_volume fscache_put_volume(fscache_volume, fscache_volume_put_relinquish) zero = __refcount_dec_and_test(&fscache_volume->ref, &ref); cachefiles_put_unbind_pincount cachefiles_daemon_unbind cachefiles_withdraw_cache cachefiles_withdraw_volumes list_del_init(&volume->cache_link) fscache_free_volume(fscache_volume) cache->ops->free_volume cachefiles_free_volume list_del_init(&cachefiles_volume->cache_link); kfree(fscache_volume) cachefiles_withdraw_volume fscache_withdraw_volume fscache_volume->n_accesses // fscache_volume UAF !!! The fscache_volume in cache->volumes must not have been freed yet, but its reference count may be 0. So use the new fscache_try_get_volume() helper function try to get its reference count. If the reference count of fscache_volume is 0, fscache_put_volume() is freeing it, so wait for it to be removed from cache->volumes. If its reference count is not 0, call cachefiles_withdraw_volume() with reference count protection to avoid the above issue.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| Debian:12 | linux | 6.1.106-1 | DEBIAN-CVE-2024-41058 |
| Debian:13 | linux | 6.9.11-1 | DEBIAN-CVE-2024-41058 |
| Debian:14 | linux | 6.9.11-1 | DEBIAN-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux | 6.8.0-48.48 | USN-7089-1 |
| Ubuntu:24.04:LTS | linux | 6.8.0-48.48 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-allwinner-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1018.20 | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-aws | 6.8.0-1018.20 | USN-7089-3 |
| Ubuntu:22.04:LTS | linux-aws-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-aws-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-aws-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1018.19~22.04.1 | USN-7089-3 |
| Ubuntu:22.04:LTS | linux-aws-6.8 | 6.8.0-1018.19~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1017.20 | USN-7089-2 |
| Ubuntu:24.04:LTS | linux-azure | 6.8.0-1017.20 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-azure-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-azure-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-azure-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1017.20~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-azure-6.8 | 6.8.0-1017.20~22.04.1 | USN-7090-1 |
| Ubuntu:22.04:LTS | linux-azure-fde-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-azure-fde-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1017.19 | USN-7089-2 |
| Ubuntu:24.04:LTS | linux-gcp | 6.8.0-1017.19 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-gcp-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-gcp-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-gcp-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1017.19~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-gcp-6.8 | 6.8.0-1017.19~22.04.1 | USN-7089-1 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1013.17 | USN-7089-6 |
| Ubuntu:24.04:LTS | linux-gke | 6.8.0-1013.17 | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-gkeop | 6.8.0-1002.4 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-48.48~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-hwe-6.8 | 6.8.0-48.48~22.04.1 | USN-7089-1 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1015.15 | USN-7089-2 |
| Ubuntu:24.04:LTS | linux-ibm | 6.8.0-1015.15 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-intel-iot-realtime | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-48.48.3 | USN-7089-7 |
| Ubuntu:24.04:LTS | linux-lowlatency | 6.8.0-48.48.3 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-48.48.3~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-lowlatency-hwe-6.8 | 6.8.0-48.48.3~22.04.1 | USN-7089-7 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1017.19 | USN-7095-1 |
| Ubuntu:24.04:LTS | linux-nvidia | 6.8.0-1017.19 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-nvidia-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-nvidia-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1017.19~22.04.1 | USN-7095-1 |
| Ubuntu:22.04:LTS | linux-nvidia-6.8 | 6.8.0-1017.19~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1017.19.1 | USN-7095-1 |
| Ubuntu:24.04:LTS | linux-nvidia-lowlatency | 6.8.0-1017.19.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oem-5.17 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oem-6.0 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oem-6.1 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oem-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1016.16 | USN-7089-4 |
| Ubuntu:24.04:LTS | linux-oem-6.8 | 6.8.0-1016.16 | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1015.16 | USN-7089-3 |
| Ubuntu:24.04:LTS | linux-oracle | 6.8.0-1015.16 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oracle-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1015.15~22.04.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-oracle-6.8 | 6.8.0-1015.15~22.04.1 | USN-7089-3 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1014.16 | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-raspi | 6.8.0-1014.16 | USN-7089-5 |
| Ubuntu:22.04:LTS | linux-realtime | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-riscv | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:24.04:LTS | linux-riscv | 6.8.0-48.48.1 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-riscv-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-riscv-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-riscv-6.8 | 6.8.0-48.48.1~22.04.2 | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-starfive-5.19 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-starfive-6.2 | no fix listed | UBUNTU-CVE-2024-41058 |
| Ubuntu:22.04:LTS | linux-starfive-6.5 | no fix listed | UBUNTU-CVE-2024-41058 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| Linux | Linux | fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 90f17e47f1e209c6a3c92a1d038a0a80c95c460efe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 9dd7f5663899ea13a6a73216106d9c13c37453e3fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 38b88d544216f806d93a273a62ff8ebe82254003fe2140e2f57fef8562e0f9b7cd447d2b08dc2f35 – before 522018a0de6b6fcce60c04f86dfc5f0e4b6a1b36 |
| Linux | Linux | 5.17 |
References
- https://git.kernel.org/stable/c/90f17e47f1e209c6a3c92a1d038a0a80c95c460e
- https://git.kernel.org/stable/c/9dd7f5663899ea13a6a73216106d9c13c37453e3
- https://git.kernel.org/stable/c/38b88d544216f806d93a273a62ff8ebe82254003
- https://git.kernel.org/stable/c/522018a0de6b6fcce60c04f86dfc5f0e4b6a1b36
- https://lists.debian.org/debian-lts-announce/2025/01/msg00001.html