CVE-2024-47689
f2fs: fix to don't set SB_RDONLY in f2fs_handle_critical_error()
Check your servers for CVE-2024-47689
The Vulnpocalypse collector sends the package list of each Linux server and of its container images once a day. Vulnpocalypse shows every server where CVE-2024-47689 affects the running kernel, with the command that installs the fix. The free plan covers one server and one domain and does not need a credit card.
Description
In the Linux kernel, the following vulnerability has been resolved:
f2fs: fix to don't set SB_RDONLY in f2fs_handle_critical_error()
syzbot reports a f2fs bug as below:
------------[ cut here ]------------ WARNING: CPU: 1 PID: 58 at kernel/rcu/sync.c:177 rcu_sync_dtor+0xcd/0x180 kernel/rcu/sync.c:177 CPU: 1 UID: 0 PID: 58 Comm: kworker/1:2 Not tainted 6.10.0-syzkaller-12562-g1722389b0d86 #0 Workqueue: events destroy_super_work RIP: 0010:rcu_sync_dtor+0xcd/0x180 kernel/rcu/sync.c:177 Call Trace: percpu_free_rwsem+0x41/0x80 kernel/locking/percpu-rwsem.c:42 destroy_super_work+0xec/0x130 fs/super.c:282 process_one_work kernel/workqueue.c:3231 [inline] process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390 kthread+0x2f0/0x390 kernel/kthread.c:389 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
As Christian Brauner pointed out [1]: the root cause is f2fs sets SB_RDONLY flag in internal function, rather than setting the flag covered w/ sb->s_umount semaphore via remount procedure, then below race condition causes this bug:
- freeze_super() - sb_wait_write(sb, SB_FREEZE_WRITE) - sb_wait_write(sb, SB_FREEZE_PAGEFAULT) - sb_wait_write(sb, SB_FREEZE_FS) - f2fs_handle_critical_error - sb->s_flags |= SB_RDONLY - thaw_super - thaw_super_locked - sb_rdonly() is true, so it skips sb_freeze_unlock(sb, SB_FREEZE_FS) - deactivate_locked_super
Since f2fs has almost the same logic as ext4 [2] when handling critical error in filesystem if it mounts w/ errors=remount-ro option: - set CP_ERROR_FLAG flag which indicates filesystem is stopped - record errors to superblock - set SB_RDONLY falg Once we set CP_ERROR_FLAG flag, all writable interfaces can detect the flag and stop any further updates on filesystem. So, it is safe to not set SB_RDONLY flag, let's remove the logic and keep in line w/ ext4 [3].
[1] https://lore.kernel.org/all/20240729-himbeeren-funknetz-96e62f9c7aee@brauner [2] https://lore.kernel.org/all/20240729132721.hxih6ehigadqf7wx@quack3 [3] https://lore.kernel.org/linux-ext4/20240805201241.27286-1-jack@suse.cz
Exploitation
EPSS 0.62%: the probability of exploitation activity in the next 30 days, from the EPSS model of FIRST. The score is higher than 51.1% of all scored CVEs. Scores of 1 Dec 2026.
The assessment of CISA (SSVC, 21 Oct 2024):
- Exploitation
- none: CISA did not find evidence of exploitation or a public proof of concept
- Automatable
- no: each attack takes manual steps
- Technical impact
- partial: limited control or limited data
Affected products
As the CNA lists them.
| Product | Versions |
|---|---|
| Linux |
affected from b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, before 649ec8b30df113042588bd3d3cd4e98bcb1091e0 affected from b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, before de43021c72993877a8f86f9fddfa0687609da5a4 affected from b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, before 1f63f405c1a1a64b9c310388aad7055fb86b245c affected from b62e71be2110d8b52bf5faf3c3ed7ca1a0c113a5, before 930c6ab93492c4b15436524e704950b364b2930c affected ed1d478bf838820201f3fb67a1748fdf15954ea4 affected from 6.4.4, before 6.5
Other versions: unaffected
|
| Linux |
affected 6.5 unaffected before 6.5 unaffected from 6.6.54 up to and including 6.6.* unaffected from 6.10.13 up to and including 6.10.* unaffected from 6.11.2 up to and including 6.11.* unaffected 6.12 and later
Other versions: affected
|
Is my server affected?
This CVE is in the Linux kernel. Compare the running kernel with the fixed kernel version of your distribution, and reboot after a kernel update:
uname -r
# Debian, Ubuntu: does the changelog of the running kernel name the CVE?
zgrep -l CVE-2024-47689 /usr/share/doc/linux-image-$(uname -r)/changelog.Debian.gz
# RHEL, Rocky, Alma
rpm -q --changelog kernel | grep CVE-2024-47689
With Trivy, on the host and for a container image. When a package is affected, it prints the installed and the fixed version:
trivy rootfs --scanners vuln / | grep CVE-2024-47689
trivy image --scanners vuln IMAGE | grep CVE-2024-47689
Vulnpocalypse makes this comparison every day for the package lists of your servers and container images, including language packages (npm, PyPI, Go, Maven and others), and sends the command that installs the fix. Start free with one server and one domain or read how to install the collector.
References
Other references
- https://git.kernel.org/stable/c/649ec8b30df113042588bd3d3cd4e98bcb1091e0 git.kernel.org
- https://git.kernel.org/stable/c/de43021c72993877a8f86f9fddfa0687609da5a4 git.kernel.org
- https://git.kernel.org/stable/c/1f63f405c1a1a64b9c310388aad7055fb86b245c git.kernel.org
- https://git.kernel.org/stable/c/930c6ab93492c4b15436524e704950b364b2930c git.kernel.org
Source: the record CVE-2024-47689 of the CVE List (CVE Program), CVE Terms of Use; the CISA KEV catalog and the CISA ADP container; EPSS of FIRST. The text of the record is shown as published. Data sources and licences.
Vulnpocalypse