{"id":41285,"date":"2026-10-19T00:33:00","date_gmt":"2026-10-18T16:33:00","guid":{"rendered":"https:\/\/www.54iter.cn\/?vuln=cve-2026-98813"},"modified":"2026-10-19T00:33:00","modified_gmt":"2026-10-18T16:33:00","slug":"cve-2026-98813","status":"publish","type":"vuln","link":"https:\/\/www.54iter.cn\/?vuln=cve-2026-98813","title":{"rendered":"CVE-2026-98813 &#8211; In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Hold map BTF for"},"content":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>bpf: Hold map BTF for the memory allocator destructor record<\/p>\n<p>bpf_ma_set_dtor() duplicates map-&gt;record so that the bpf_mem_alloc<br \/>\ndestructor can release the special fields of hash and rhash map elements<br \/>\nonce the allocator frees them for good. btf_record_dup() only acquires<br \/>\nreferences on kernel and module BTF. Fields whose types live in the map<br \/>\nBTF keep pointing into it: a kptr to a local type refers to map-&gt;btf,<br \/>\nand a list_head or rb_root field carries a value_rec owned by the struct<br \/>\nmeta table of map-&gt;btf.<\/p>\n<p>That borrowed state can outlive the map. When RCU callbacks are still in<br \/>\nflight, bpf_mem_alloc_destroy() copies the allocator and defers the final<br \/>\ndrain, together with the destructor context, to a workqueue.<br \/>\nbpf_map_free() then frees map-&gt;record and drops the map&#8217;s BTF reference<br \/>\nas soon as map_free() returns. Once the program that loaded the BTF is<br \/>\ngone as well, the BTF is freed while the worker still uses the<br \/>\nduplicate. The worker dereferences it through btf_is_kernel() and<br \/>\nbtf_find_struct_meta() in bpf_obj_free_fields() when destroying elements<br \/>\nthat were freed under RCU, and through btf_is_kernel() in<br \/>\nbtf_record_free() when releasing the context itself:<\/p>\n<p>  BUG: KASAN: slab-use-after-free in btf_is_kernel+0x19\/0x30<br \/>\n  Read of size 1 at addr ffff88811505dce8 by task kworker\/u16:2\/50<br \/>\n  Workqueue: events_unbound free_mem_alloc_deferred<br \/>\n  Call Trace:<br \/>\n   btf_is_kernel+0x19\/0x30<br \/>\n   btf_record_free+0xc7\/0xf0<br \/>\n   htab_dtor_ctx_free+0x1a\/0x30<br \/>\n   free_mem_alloc_no_barrier+0x39\/0x230<br \/>\n   free_mem_alloc_deferred+0x2a\/0x40<br \/>\n   process_scheduled_works+0x5ce\/0x9d0<br \/>\n   worker_thread+0x42a\/0x5e0<br \/>\n   kthread+0x1f5\/0x230<br \/>\n   ret_from_fork+0x1dd\/0x390<br \/>\n   ret_from_fork_asm+0x1a\/0x30<\/p>\n<p>  Allocated by task 358:<br \/>\n   __kmalloc_cache_noprof+0x287\/0x510<br \/>\n   btf_new_fd+0xf7\/0x3d0<br \/>\n   __sys_bpf+0x487\/0x840<\/p>\n<p>  Freed by task 0:<br \/>\n   kfree+0x186\/0x560<br \/>\n   rcu_core+0x6f6\/0xd40<\/p>\n<p>Freeing a map that still holds more elements than the allocator&#8217;s high<br \/>\nwatermark is enough to get there, because the bulk free during teardown<br \/>\nqueues the RCU callback that makes bpf_mem_alloc_destroy() defer.<br \/>\nNon-preallocated hash maps and resizable hash maps both register the<br \/>\ndestructor and are affected alike.<\/p>\n<p>Keep one reference on the map BTF in the destructor context. Every<br \/>\nnon-kernel pointer in the duplicated record is either map-&gt;btf or memory<br \/>\nowned by it, so a single reference covers kptrs, list heads, and rb<br \/>\nroots, and mirrors what bpf_map_meta_alloc() does for the duplicated<br \/>\nrecord of an inner map. Release it only after the duplicated record has<br \/>\nbeen freed: the worker is preemptible and not in an RCU read-side<br \/>\ncritical section, so dropping the last reference first would let the<br \/>\nBTF be freed while btf_record_free() still reads its fields.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>bpf: Hold map BTF for the memory allocator destructor record<\/p>\n<p>bpf_ma_set_dtor() duplicates map-&gt;record so that the bpf_mem_alloc<br \/>\nde<\/p>\n","protected":false},"template":"","meta":[],"categories":[],"tags":[],"class_list":["post-41285","vuln","type-vuln","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln\/41285","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln"}],"about":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/types\/vuln"}],"wp:attachment":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=41285"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=41285"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=41285"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}