Vulnerability · Published Nov 5, 2024 · Assigned by Linux

CVE-2024-50118btrfs: reject ro->rw reconfiguration if there are hard ro requirements

Medium 5.5

In plain English

A medium-severity null pointer dereference 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.2% (higher than 8% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)5.5Medium
Exploit odds (30 days)0.2%top 91.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

Official description

In the Linux kernel, the following vulnerability has been resolved: btrfs: reject ro->rw reconfiguration if there are hard ro requirements [BUG] Syzbot reports the following crash: BTRFS info (device loop0 state MCS): disabling free space tree BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE_SPACE_TREE (0x1) BTRFS info (device loop0 state MCS): clearing compat-ro feature flag for FREE_SPACE_TREE_VALID (0x2) Oops: general protection fault, probably for non-canonical address 0xdffffc0000000003: 0000 [#1] PREEMPT SMP KASAN NOPTI KASAN: null-ptr-deref in range [0x0000000000000018-0x000000000000001f] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.3-debian-1.16.3-2~bpo12+1 04/01/2014 RIP: 0010:backup_super_roots fs/btrfs/disk-io.c:1691 [inline] RIP: 0010:write_all_supers+0x97a/0x40f0 fs/btrfs/disk-io.c:4041 Call Trace: <TASK> btrfs_commit_transaction+0x1eae/0x3740 fs/btrfs/transaction.c:2530 btrfs_delete_free_space_tree+0x383/0x730 fs/btrfs/free-space-tree.c:1312 btrfs_start_pre_rw_mount+0xf28/0x1300 fs/btrfs/disk-io.c:3012 btrfs_remount_rw fs/btrfs/super.c:1309 [inline] btrfs_reconfigure+0xae6/0x2d40 fs/btrfs/super.c:1534 btrfs_reconfigure_for_mount fs/btrfs/super.c:2020 [inline] btrfs_get_tree_subvol fs/btrfs/super.c:2079 [inline] btrfs_get_tree+0x918/0x1920 fs/btrfs/super.c:2115 vfs_get_tree+0x90/0x2b0 fs/super.c:1800 do_new_mount+0x2be/0xb40 fs/namespace.c:3472 do_mount fs/namespace.c:3812 [inline] __do_sys_mount fs/namespace.c:4020 [inline] __se_sys_mount+0x2d6/0x3c0 fs/namespace.c:3997 do_syscall_x64 arch/x86/entry/common.c:52 [inline] do_syscall_64+0xf3/0x230 arch/x86/entry/common.c:83 entry_SYSCALL_64_after_hwframe+0x77/0x7f [CAUSE] To support mounting different subvolume with different RO/RW flags for the new mount APIs, btrfs introduced two workaround to support this feature: - Skip mount option/feature checks if we are mounting a different subvolume - Reconfigure the fs to RW if the initial mount is RO Combining these two, we can have the following sequence: - Mount the fs ro,rescue=all,clear_cache,space_cache=v1 rescue=all will mark the fs as hard read-only, so no v2 cache clearing will happen. - Mount a subvolume rw of the same fs. We go into btrfs_get_tree_subvol(), but fc_mount() returns EBUSY because our new fc is RW, different from the original fs. Now we enter btrfs_reconfigure_for_mount(), which switches the RO flag first so that we can grab the existing fs_info. Then we reconfigure the fs to RW. - During reconfiguration, option/features check is skipped This means we will restart the v2 cache clearing, and convert back to v1 cache. This will trigger fs writes, and since the original fs has "rescue=all" option, it skips the csum tree read. And eventually causing NULL pointer dereference in super block writeback. [FIX] For reconfiguration caused by different subvolume RO/RW flags, ensure we always run btrfs_check_options() to ensure we have proper hard RO requirements met. In fact the function btrfs_check_options() doesn't really do many complex checks, but hard RO requirement and some feature dependency checks, thus there is no special reason not to do the check for mount reconfiguration.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Debian:13linux6.11.6-1DEBIAN-CVE-2024-50118
Debian:14linux6.11.6-1DEBIAN-CVE-2024-50118
Ubuntu:24.04:LTSlinux6.8.0-58.60UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux6.8.0-58.60USN-7449-1
Ubuntu:22.04:LTSlinux-allwinner-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-aws6.8.0-1027.29USN-7449-1
Ubuntu:24.04:LTSlinux-aws6.8.0-1027.29UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-aws-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-aws-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-aws-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-aws-6.86.8.0-1027.29~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-azure6.8.0-1027.32UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-azure6.8.0-1027.32USN-7449-1
Ubuntu:22.04:LTSlinux-azure-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-azure-6.116.11.0-1012.12~24.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-azure-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-azure-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1027.32~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-azure-6.86.8.0-1027.32~22.04.1USN-7449-1
Ubuntu:22.04:LTSlinux-azure-fde-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-azure-fde-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-azure-nvidia6.8.0-1014.15UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-gcp6.8.0-1028.30UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-gcp6.8.0-1028.30USN-7450-1
Ubuntu:22.04:LTSlinux-gcp-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-gcp-6.116.11.0-1011.11~24.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-gcp-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-gcp-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1028.30~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-gcp-6.86.8.0-1028.30~22.04.1USN-7452-1
Ubuntu:24.04:LTSlinux-gke6.8.0-1023.27USN-7450-1
Ubuntu:24.04:LTSlinux-gke6.8.0-1023.27UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-gkeop6.8.0-1010.12USN-7450-1
Ubuntu:24.04:LTSlinux-gkeop6.8.0-1010.12UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-hwe-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-hwe-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-hwe-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-58.60~22.04.1USN-7449-2
Ubuntu:22.04:LTSlinux-hwe-6.86.8.0-58.60~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-ibm6.8.0-1024.24UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-ibm6.8.0-1024.24USN-7449-1
Ubuntu:22.04:LTSlinux-ibm-6.86.8.0-1024.24~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-intel-iot-realtimeno fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-58.60.1USN-7449-1
Ubuntu:24.04:LTSlinux-lowlatency6.8.0-58.60.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-lowlatency-hwe-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-58.60.1~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-lowlatency-hwe-6.86.8.0-58.60.1~22.04.1USN-7449-1
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1026.29USN-7449-1
Ubuntu:24.04:LTSlinux-nvidia6.8.0-1026.29UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-nvidia-6.116.11.0-1007.7UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-nvidia-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-nvidia-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1026.29~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-nvidia-6.86.8.0-1026.29~22.04.1USN-7449-1
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1026.29.1USN-7449-1
Ubuntu:24.04:LTSlinux-nvidia-lowlatency6.8.0-1026.29.1UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-nvidia-tegra6.8.0-1008.8UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-oem-5.17no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-oem-6.0no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-oem-6.1no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-oem-6.116.11.0-1015.15UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-oem-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1026.26UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-oem-6.86.8.0-1026.26USN-7449-1
Ubuntu:24.04:LTSlinux-oracle6.8.0-1024.25USN-7449-1
Ubuntu:24.04:LTSlinux-oracle6.8.0-1024.25UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-oracle-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1024.25~22.04.1USN-7449-1
Ubuntu:22.04:LTSlinux-oracle-6.86.8.0-1024.25~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-raspi6.8.0-1028.32UBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-raspi-realtimeno fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-realtimeno fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-riscvno fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-riscv6.8.0-58.60.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-riscv-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-riscv-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-riscv-6.86.8.0-58.60.1~22.04.1UBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-starfive-5.19no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-starfive-6.2no fix listedUBUNTU-CVE-2024-50118
Ubuntu:22.04:LTSlinux-starfive-6.5no fix listedUBUNTU-CVE-2024-50118
Ubuntu:24.04:LTSlinux-xilinx6.8.0-1017.18UBUNTU-CVE-2024-50118

Affected products (as reported)

VendorProductVersions
Linux Linux f044b318675f0347ecfb88377542651ba4eb9e1f – before 23724398b55d9570f6ae79dd2ea026fff8896bf1f044b318675f0347ecfb88377542651ba4eb9e1f – before 3c36a72c1d27de6618c1c480c793d9924640f5bb
Linux Linux 6.8

Weakness: CWE-476 · Vector: CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H

References