{ "dataType": "CVE_RECORD", "dataVersion": "5.2", "cveMetadata": { "cveId": "CVE-2024-47741", "assignerOrgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "state": "PUBLISHED", "assignerShortName": "Linux", "dateReserved": "2024-09-30T16:00:12.959Z", "datePublished": "2024-10-21T12:14:09.836Z", "dateUpdated": "2026-08-05T11:39:51.796Z" }, "containers": { "cna": { "providerMetadata": { "orgId": "416baaa9-dc9f-4396-8d5f-8c081fb06d67", "shortName": "Linux", "dateUpdated": "2026-08-05T11:39:51.796Z" }, "descriptions": [ { "lang": "en", "value": "In the Linux kernel, the following vulnerability has been resolved:\n\nbtrfs: fix race setting file private on concurrent lseek using same fd\n\nWhen doing concurrent lseek(2) system calls against the same file\ndescriptor, using multiple threads belonging to the same process, we have\na short time window where a race happens and can result in a memory leak.\n\nThe race happens like this:\n\n1) A program opens a file descriptor for a file and then spawns two\n threads (with the pthreads library for example), lets call them\n task A and task B;\n\n2) Task A calls lseek with SEEK_DATA or SEEK_HOLE and ends up at\n file.c:find_desired_extent() while holding a read lock on the inode;\n\n3) At the start of find_desired_extent(), it extracts the file's\n private_data pointer into a local variable named 'private', which has\n a value of NULL;\n\n4) Task B also calls lseek with SEEK_DATA or SEEK_HOLE, locks the inode\n in shared mode and enters file.c:find_desired_extent(), where it also\n extracts file->private_data into its local variable 'private', which\n has a NULL value;\n\n5) Because it saw a NULL file private, task A allocates a private\n structure and assigns to the file structure;\n\n6) Task B also saw a NULL file private so it also allocates its own file\n private and then assigns it to the same file structure, since both\n tasks are using the same file descriptor.\n\n At this point we leak the private structure allocated by task A.\n\nBesides the memory leak, there's also the detail that both tasks end up\nusing the same cached state record in the private structure (struct\nbtrfs_file_private::llseek_cached_state), which can result in a\nuse-after-free problem since one task can free it while the other is\nstill using it (only one task took a reference count on it). Also, sharing\nthe cached state is not a good idea since it could result in incorrect\nresults in the future - right now it should not be a problem because it\nend ups being used only in extent-io-tree.c:count_range_bits() where we do\nrange validation before using the cached state.\n\nFix this by protecting the private assignment and check of a file while\nholding the inode's spinlock and keep track of the task that allocated\nthe private, so that it's used only by that task in order to prevent\nuser-after-free issues with the cached state record as well as potentially\nusing it incorrectly in the future." } ], "metrics": [ { "cvssV3_1": { "version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH" }, "scenarios": [ { "lang": "en", "value": "AV:L - The vulnerable code is reached via the lseek(2) syscall with SEEK_DATA/SEEK_HOLE on a btrfs file descriptor, requiring local system access. (It is additionally reachable by remote peers when btrfs is re-exported via nfsd's NFSv4.2 SEEK or ksmbd's FSCTL_QUERY_ALLOCATED_RANGES, but that depends on an optional service, so the base vector remains Local.)\nAC:L - The attacker controls both sides of the race entirely — spawning two threads that hammer lseek() on the same fd — and the window spans a sleeping kzalloc(GFP_KERNEL), making it wide and reliably winnable. The attempt can be repeated without limit by closing and reopening the file to reset file->private_data to NULL.\nPR:L - Any unprivileged local user needs only an open file descriptor on a regular file on a btrfs filesystem, which they can create themselves in /home or /tmp on distributions defaulting to btrfs. No capability, namespace, or mount privilege is checked anywhere on the btrfs_file_llseek() -> find_desired_extent() path.\nUI:N - The attacker performs the open, the thread creation, and both racing lseek calls entirely on their own; no victim action or interaction is required.\nS:U - The corrupted and leaked objects (struct btrfs_file_private and struct extent_state) are kernel heap objects within the same security authority as the compromised kernel; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - The shared llseek_cached_state slot carries only a single refcount for two owners, so count_range_bits() can dereference a freed struct extent_state and walk its rb_node links; the attacker can spray the dedicated slab to reallocate the freed object and read back kernel data, so per UAF guidance this is High.\nI:H - The use-after-free yields refcount_inc/free_extent_state operations and rb-tree pointer writes against attacker-groomed freed memory, which is a classic heap-spray path to an arbitrary write and control-flow hijack.\nA:H - The use-after-free on struct extent_state causes oopses and panics even when not weaponized, and the memory leak is unbounded and attacker-driven — every won race permanently leaks a btrfs_file_private plus a pinned extent_state, so a loop exhausts kernel memory and forces OOM." } ] } ], "affected": [ { "product": "Linux", "vendor": "Linux", "defaultStatus": "unaffected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "fs/btrfs/btrfs_inode.h", "fs/btrfs/ctree.h", "fs/btrfs/file.c" ], "versions": [ { "version": "3c32c7212f1639471ec0197ff1179b8ef2e0f3d3", "lessThan": "f56a6d9c267ec7fa558ede7755551c047b1034cd", "status": "affected", "versionType": "git" }, { "version": "3c32c7212f1639471ec0197ff1179b8ef2e0f3d3", "lessThan": "a412ca489ac27b9d0e603499315b7139c948130d", "status": "affected", "versionType": "git" }, { "version": "3c32c7212f1639471ec0197ff1179b8ef2e0f3d3", "lessThan": "33d1310d4496e904123dab9c28b2d8d2c1800f97", "status": "affected", "versionType": "git" }, { "version": "3c32c7212f1639471ec0197ff1179b8ef2e0f3d3", "lessThan": "7ee85f5515e86a4e2a2f51969795920733912bad", "status": "affected", "versionType": "git" } ] }, { "product": "Linux", "vendor": "Linux", "defaultStatus": "affected", "repo": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git", "programFiles": [ "fs/btrfs/btrfs_inode.h", "fs/btrfs/ctree.h", "fs/btrfs/file.c" ], "versions": [ { "version": "6.2", "status": "affected" }, { "version": "0", "lessThan": "6.2", "status": "unaffected", "versionType": "semver" }, { "version": "6.6.54", "lessThanOrEqual": "6.6.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.10.13", "lessThanOrEqual": "6.10.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.11.2", "lessThanOrEqual": "6.11.*", "status": "unaffected", "versionType": "semver" }, { "version": "6.12", "lessThanOrEqual": "*", "status": "unaffected", "versionType": "original_commit_for_fix" } ] } ], "cpeApplicability": [ { "nodes": [ { "operator": "OR", "negate": false, "cpeMatch": [ { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.2", "versionEndExcluding": "6.6.54" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.2", "versionEndExcluding": "6.10.13" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.2", "versionEndExcluding": "6.11.2" }, { "vulnerable": true, "criteria": "cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*", "versionStartIncluding": "6.2", "versionEndExcluding": "6.12" } ] } ] } ], "references": [ { "url": "https://git.kernel.org/stable/c/f56a6d9c267ec7fa558ede7755551c047b1034cd" }, { "url": "https://git.kernel.org/stable/c/a412ca489ac27b9d0e603499315b7139c948130d" }, { "url": "https://git.kernel.org/stable/c/33d1310d4496e904123dab9c28b2d8d2c1800f97" }, { "url": "https://git.kernel.org/stable/c/7ee85f5515e86a4e2a2f51969795920733912bad" } ], "title": "btrfs: fix race setting file private on concurrent lseek using same fd", "x_generator": { "engine": "bippy-1.2.0" } }, "adp": [ { "metrics": [ { "other": { "type": "ssvc", "content": { "id": "CVE-2024-47741", "role": "CISA Coordinator", "options": [ { "Exploitation": "none" }, { "Automatable": "no" }, { "Technical Impact": "partial" } ], "version": "2.0.3", "timestamp": "2024-10-21T12:59:11.632637Z" } } } ], "title": "CISA ADP Vulnrichment", "providerMetadata": { "orgId": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "shortName": "CISA-ADP", "dateUpdated": "2024-10-21T13:04:14.475Z" } } ] } }