{"id":65878,"date":"2025-07-09T16:32:54","date_gmt":"2025-07-09T13:02:54","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2025-38260-linux-btrfs-rescueibadroots-null-pointer-dereference-vulnerability\/"},"modified":"2025-07-09T16:32:54","modified_gmt":"2025-07-09T13:02:54","slug":"cve-2025-38260-linux-btrfs-rescueibadroots-null-pointer-dereference-vulnerability","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2025-38260-linux-btrfs-rescueibadroots-null-pointer-dereference-vulnerability\/","title":{"rendered":"CVE-2025-38260 &#8211; Linux Btrfs rescue=ibadroots null pointer dereference vulnerability"},"content":{"rendered":"<p><strong>CVE ID : <\/strong>CVE-2025-38260<br \/>\n<br \/>\n<strong>Published : <\/strong> July 9, 2025, 11:15 a.m. | 49\u00a0minutes ago<br \/>\n<br \/>\n<strong>Description : <\/strong>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>btrfs: handle csum tree error with rescue=ibadroots correctly<\/p>\n[BUG]\nThere is syzbot based reproducer that can crash the kernel, with the<br \/>\nfollowing call trace: (With some debug output added)<\/p>\n<p> DEBUG: rescue=ibadroots parsed<br \/>\n BTRFS: device fsid 14d642db-7b15-43e4-81e6-4b8fac6a25f8 devid 1 transid 8 \/dev\/loop0 (7:0) scanned by repro (1010)<br \/>\n BTRFS info (device loop0): first mount of filesystem 14d642db-7b15-43e4-81e6-4b8fac6a25f8<br \/>\n BTRFS info (device loop0): using blake2b (blake2b-256-generic) checksum algorithm<br \/>\n BTRFS info (device loop0): using free-space-tree<br \/>\n BTRFS warning (device loop0): checksum verify failed on logical 5312512 mirror 1 wanted 0xb043382657aede36608fd3386d6b001692ff406164733d94e2d9a180412c6003 found 0x810ceb2bacb7f0f9eb2bf3b2b15c02af867cb35ad450898169f3b1f0bd818651 level 0<br \/>\n DEBUG: read tree root path failed for tree csum, ret=-5<br \/>\n BTRFS warning (device loop0): checksum verify failed on logical 5328896 mirror 1 wanted 0x51be4e8b303da58e6340226815b70e3a93592dac3f30dd510c7517454de8567a found 0x51be4e8b303da58e634022a315b70e3a93592dac3f30dd510c7517454de8567a level 0<br \/>\n BTRFS warning (device loop0): checksum verify failed on logical 5292032 mirror 1 wanted 0x1924ccd683be9efc2fa98582ef58760e3848e9043db8649ee382681e220cdee4 found 0x0cb6184f6e8799d9f8cb335dccd1d1832da1071d12290dab3b85b587ecacca6e level 0<br \/>\n process &#8216;repro&#8217; launched &#8216;.\/file2&#8217; with NULL argv: empty string added<br \/>\n DEBUG: no csum root, idatacsums=0 ibadroots=134217728<br \/>\n Oops: general protection fault, probably for non-canonical address 0xdffffc0000000041: 0000 [#1] SMP KASAN NOPTI<br \/>\n KASAN: null-ptr-deref in range [0x0000000000000208-0x000000000000020f]\n CPU: 5 UID: 0 PID: 1010 Comm: repro Tainted: G           OE       6.15.0-custom+ #249 PREEMPT(full)<br \/>\n Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS unknown 02\/02\/2022<br \/>\n RIP: 0010:btrfs_lookup_csum+0x93\/0x3d0 [btrfs]\n Call Trace:<\/p>\n<p>  btrfs_lookup_bio_sums+0x47a\/0xdf0 [btrfs]\n  btrfs_submit_bbio+0x43e\/0x1a80 [btrfs]\n  submit_one_bio+0xde\/0x160 [btrfs]\n  btrfs_readahead+0x498\/0x6a0 [btrfs]\n  read_pages+0x1c3\/0xb20<br \/>\n  page_cache_ra_order+0x4b5\/0xc20<br \/>\n  filemap_get_pages+0x2d3\/0x19e0<br \/>\n  filemap_read+0x314\/0xde0<br \/>\n  __kernel_read+0x35b\/0x900<br \/>\n  bprm_execve+0x62e\/0x1140<br \/>\n  do_execveat_common.isra.0+0x3fc\/0x520<br \/>\n  __x64_sys_execveat+0xdc\/0x130<br \/>\n  do_syscall_64+0x54\/0x1d0<br \/>\n  entry_SYSCALL_64_after_hwframe+0x76\/0x7e<br \/>\n &#8212;[ end trace 0000000000000000 ]&#8212;<\/p>\n[CAUSE]\nFirstly the fs has a corrupted csum tree root, thus to mount the fs we<br \/>\nhave to go &#8220;ro,rescue=ibadroots&#8221; mount option.<\/p>\n<p>Normally with that mount option, a bad csum tree root should set<br \/>\nBTRFS_FS_STATE_NO_DATA_CSUMS flag, so that any future data read will<br \/>\nignore csum search.<\/p>\n<p>But in this particular case, we have the following call trace that<br \/>\ncaused NULL csum root, but not setting BTRFS_FS_STATE_NO_DATA_CSUMS:<\/p>\n<p>load_global_roots_objectid():<\/p>\n<p>\t\tret = btrfs_search_slot();<br \/>\n\t\t\/* Succeeded *\/<br \/>\n\t\tbtrfs_item_key_to_cpu()<br \/>\n\t\tfound = true;<br \/>\n\t\t\/* We found the root item for csum tree. *\/<br \/>\n\t\troot = read_tree_root_path();<br \/>\n\t\tif (IS_ERR(root)) {<br \/>\n\t\t\tif (!btrfs_test_opt(fs_info, IGNOREBADROOTS))<br \/>\n\t\t\t\/*<br \/>\n\t\t\t * Since we have rescue=ibadroots mount option,<br \/>\n\t\t\t * @ret is still 0.<br \/>\n\t\t\t *\/<br \/>\n\t\t\tbreak;<br \/>\n\tif (!found || ret) {<br \/>\n\t\t\/* @found is true, @ret is 0, error handling for csum<br \/>\n\t\t * tree is skipped.<br \/>\n\t\t *\/<br \/>\n\t}<\/p>\n<p>This means we completely skipped to set BTRFS_FS_STATE_NO_DATA_CSUMS if<br \/>\nthe csum tree is corrupted, which results unexpected later csum lookup.<\/p>\n[FIX]\nIf read_tree_root_path() failed, always populate @ret to the error<br \/>\nnumber.<\/p>\n<p>As at the end of the function, we need @ret to determine if we need to<br \/>\ndo the extra error handling for csum tree.<br \/>\n<br \/>\n<strong>Severity:<\/strong> 0.0 | NA<br \/>\n<br \/>\nVisit the link for more details, such as CVSS details, affected products, timeline, and more&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>CVE ID : CVE-2025-38260 Published : July 9, 2025, 11:15 a.m. | 49\u00a0minutes ago Description : In the Linux kernel, the following vulnerability has been resolved: btrfs: handle csum tree error with rescue=ibadroots correctly [BUG] There is syzbot based reproducer that can crash the kernel, with the following call trace: (With some debug output added) &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-65878","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/65878","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=65878"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/65878\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=65878"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=65878"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=65878"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}