Cloudanix VulnDB

CVE-2024-49932

None

CVSS

—

EPSS

0.2%

Published

Oct 21, 2024

CISA due date

—

Cloudanix analysis

Schedule a fix SSVC: Track

A flaw in Linux filesystem handling can cause the entire system to crash when certain maintenance operations run on specific storage configurations.

Exploitation
Local Privilege
Attacker needs
High Privilege
Complexity
Moderate
Impact
Denial Of Service
Component
OS kernel
Class
Memory Corruption
Remediation
Upgrade
Effort
Medium
Patch risk
Medium

What it actually does

The vulnerability causes btrfs readahead during block group relocation to ignore ENOENT errors from RAID stripe tree lookups on preallocated extents, resulting in submission of invalid I/O requests that trigger a kernel BUG assertion in the scatter-gather list code.

Why it matters to the business

Filesystem balance or data relocation operations on btrfs volumes using RAID stripe trees can trigger immediate kernel crashes, leading to unplanned downtime and potential data inconsistency risks until the system is recovered.

How an attack unfolds

An attacker with local access initiates a btrfs balance or chunk relocation on a filesystem backed by a RAID stripe tree containing unmapped preallocated extents; the readahead path fails to handle the lookup error, submits malformed requests to the block layer, and crashes the kernel via an invalid opcode in __blk_rq_map_sg.

How to fix it

Update the Linux kernel to a version containing commit f7a1218a983ab98aba140dc20b25f60b39ee4033 or later stable releases that prevent readahead submission on RST lookup failure; avoid triggering balance operations until patched.

How to confirm the fix worked

Confirm the running kernel contains the referenced commit or later; attempt a controlled btrfs balance on a test RST-backed volume and verify absence of the 'cannot find raid-stripe' error followed by the scatterlist BUG.

Typical attack path

  1. Obtain local shell or trigger privileged btrfs ioctl
  2. Start balance or relocation of a data block group on RST-backed volume
  3. Trigger readahead on relocation inode for extents absent from the stripe tree
  4. Cause kernel BUG and oops in block request mapping

How to detect it

Search kernel logs and dmesg for 'BTRFS error.*cannot find raid-stripe', 'kernel BUG at include/linux/scatterlist.h', and 'Oops: invalid opcode' during btrfs balance or relocation tasks; correlate with process names containing 'btrfs'.

  • cannot find raid-stripe for logical
  • kernel BUG at include/linux/scatterlist.h:115
  • __blk_rq_map_sg+0x339/0x4a0
  • relocate_file_extent_cluster
  • btrfs_relocate_block_group

What your security team should do

  • Prioritize kernel updates on all systems using btrfs with RAID stripe trees
  • Monitor for balance/relocate operations in high-availability environments
  • Temporarily restrict unprivileged use of btrfs balance ioctls where feasible

The record

In the Linux kernel, the following vulnerability has been resolved: btrfs: don't readahead the relocation inode on RST On relocation we're doing readahead on the relocation inode, but if the filesystem is backed by a RAID stripe tree we can get ENOENT (e.g. due to preallocated extents not being mapped in the RST) from the lookup. But readahead doesn't handle the error and submits invalid reads to the device, causing an assertion in the scatter-gather list code: BTRFS info (device nvme1n1): balance: start -d -m -s BTRFS info (device nvme1n1): relocating block group 6480920576 flags data|raid0 BTRFS error (device nvme1n1): cannot find raid-stripe for logical [6481928192, 6481969152] devid 2, profile raid0 ------------[ cut here ]------------ kernel BUG at include/linux/scatterlist.h:115! Oops: invalid opcode: 0000 [#1] PREEMPT SMP PTI CPU: 0 PID: 1012 Comm: btrfs Not tainted 6.10.0-rc7+ #567 RIP: 0010:__blk_rq_map_sg+0x339/0x4a0 RSP: 0018:ffffc90001a43820 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffea00045d4802 RDX: 0000000117520000 RSI: 0000000000000000 RDI: ffff8881027d1000 RBP: 0000000000003000 R08: ffffea00045d4902 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000001000 R12: ffff8881003d10b8 R13: ffffc90001a438f0 R14: 0000000000000000 R15: 0000000000003000 FS: 00007fcc048a6900(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000000002cd11000 CR3: 00000001109ea001 CR4: 0000000000370eb0 Call Trace: <TASK> ? __die_body.cold+0x14/0x25 ? die+0x2e/0x50 ? do_trap+0xca/0x110 ? do_error_trap+0x65/0x80 ? __blk_rq_map_sg+0x339/0x4a0 ? exc_invalid_op+0x50/0x70 ? __blk_rq_map_sg+0x339/0x4a0 ? asm_exc_invalid_op+0x1a/0x20 ? __blk_rq_map_sg+0x339/0x4a0 nvme_prep_rq.part.0+0x9d/0x770 nvme_queue_rq+0x7d/0x1e0 __blk_mq_issue_directly+0x2a/0x90 ? blk_mq_get_budget_and_tag+0x61/0x90 blk_mq_try_issue_list_directly+0x56/0xf0 blk_mq_flush_plug_list.part.0+0x52b/0x5d0 __blk_flush_plug+0xc6/0x110 blk_finish_plug+0x28/0x40 read_pages+0x160/0x1c0 page_cache_ra_unbounded+0x109/0x180 relocate_file_extent_cluster+0x611/0x6a0 ? btrfs_search_slot+0xba4/0xd20 ? balance_dirty_pages_ratelimited_flags+0x26/0xb00 relocate_data_extent.constprop.0+0x134/0x160 relocate_block_group+0x3f2/0x500 btrfs_relocate_block_group+0x250/0x430 btrfs_relocate_chunk+0x3f/0x130 btrfs_balance+0x71b/0xef0 ? kmalloc_trace_noprof+0x13b/0x280 btrfs_ioctl+0x2c2e/0x3030 ? kvfree_call_rcu+0x1e6/0x340 ? list_lru_add_obj+0x66/0x80 ? mntput_no_expire+0x3a/0x220 __x64_sys_ioctl+0x96/0xc0 do_syscall_64+0x54/0x110 entry_SYSCALL_64_after_hwframe+0x76/0x7e RIP: 0033:0x7fcc04514f9b Code: Unable to access opcode bytes at 0x7fcc04514f71. RSP: 002b:00007ffeba923370 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fcc04514f9b RDX: 00007ffeba923460 RSI: 00000000c4009420 RDI: 0000000000000003 RBP: 0000000000000000 R08: 0000000000000013 R09: 0000000000000001 R10: 00007fcc043fbba8 R11: 0000000000000246 R12: 00007ffeba924fc5 R13: 00007ffeba923460 R14: 0000000000000002 R15: 00000000004d4bb0 </TASK> Modules linked in: ---[ end trace 0000000000000000 ]--- RIP: 0010:__blk_rq_map_sg+0x339/0x4a0 RSP: 0018:ffffc90001a43820 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffea00045d4802 RDX: 0000000117520000 RSI: 0000000000000000 RDI: ffff8881027d1000 RBP: 0000000000003000 R08: ffffea00045d4902 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000001000 R12: ffff8881003d10b8 R13: ffffc90001a438f0 R14: 0000000000000000 R15: 0000000000003000 FS: 00007fcc048a6900(0000) GS:ffff88813bc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007fcc04514f71 CR3: 00000001109ea001 CR4: 0000000000370eb0 Kernel p ---truncated---

Affected packages

Ecosystem Package Introduced Fixed
Debian:11 linux 0 No fix
Debian:12 linux 0 No fix
Debian:13 linux 0 No fix
Debian:13 linux 0 6.11.4-1
Linux Kernel 0 6.11.3
Linux Kernel 6.7.0 6.11.3
Ubuntu:24.10 linux 0 6.11.0-18.18
Ubuntu:24.10 linux-aws 0 6.11.0-1009.10
Ubuntu:24.10 linux-azure 0 6.11.0-1009.9
Ubuntu:24.10 linux-gcp 0 6.11.0-1009.9
Ubuntu:24.10 linux-lowlatency 0 6.11.0-1010.11
Ubuntu:24.10 linux-oracle 0 6.11.0-1011.12
Ubuntu:24.10 linux-raspi 0 6.11.0-1008.8
Ubuntu:24.10 linux-realtime 0 6.11.0-1005.5
openSUSE:Tumbleweed kernel-source 0 6.11.8-1.1
openSUSE:Tumbleweed kernel-source-longterm 0 6.12.11-1.1

Related vulnerabilities