{"id":29305,"date":"2026-09-25T20:32:23","date_gmt":"2026-09-25T12:32:23","guid":{"rendered":"https:\/\/www.54iter.cn\/?vuln=cve-2026-98151"},"modified":"2026-09-25T20:32:23","modified_gmt":"2026-09-25T12:32:23","slug":"cve-2026-98151","status":"publish","type":"vuln","link":"https:\/\/www.54iter.cn\/?vuln=cve-2026-98151","title":{"rendered":"CVE-2026-98151 &#8211; In the Linux kernel, the following vulnerability has been resolved:\n\nbpf: Fix REG INVARIAN"},"content":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>bpf: Fix REG INVARIANTS VIOLATION on speculative pointer arithmetic<\/p>\n<p>Take the following unprivileged program as an example:<\/p>\n<p>\tr0 = bpf_map_lookup_elem(&#8230;)\t\/* PTR_TO_MAP_VALUE, offset 0 *\/<br \/>\n\t&#8230;<br \/>\n\t14: r0 += r1\t\t\t\/* r1 is a bounded scalar *\/<br \/>\n\t15: r9 = r0<\/p>\n<p>Loading it triggers a verifier warning from reg_bounds_sanity_check():<\/p>\n<p>\tverifier bug: REG INVARIANTS VIOLATION (alu): const subreg tnum out<br \/>\n\tof sync with range bounds r64={.base=0x0, .size=0x0}<br \/>\n\tr32={.base=0x0, .size=0xffffffff} var_off=(0x0, 0x0)<\/p>\n<p>What happens:<\/p>\n<p>1. Processing insn 14 (r0 += r1) in adjust_ptr_min_max_vals(), the new<br \/>\n   offset is computed into dst_reg&#8217;s var_off and 32\/64-bit ranges.<\/p>\n<p>2. Because pointer registers do not track 32-bit subregister bounds,<br \/>\n   __mark_reg32_unbounded() first sets r32 to the full range; r32 is<br \/>\n   re-derived from the offset at the end of the function by<br \/>\n   reg_bounds_sync().<\/p>\n<p>3. On the unprivileged path, sanitize_ptr_alu() is called and, via<br \/>\n   sanitize_speculative_path() -&gt; push_stack(), snapshots the current<br \/>\n   register state and schedules the next instruction (insn 15) to be<br \/>\n   verified directly as a speculative path.<\/p>\n<p>4. That snapshot is taken between step 2 and the final reg_bounds_sync():<br \/>\n   at this point dst_reg&#8217;s var_off still holds the (const) original<br \/>\n   offset while r32 has just been blanked to the full range, i.e. the two<br \/>\n   are out of sync. When the speculative path later verifies insn 15<br \/>\n   (r9 = r0), the inconsistent state reaches reg_bounds_sanity_check() and<br \/>\n   trips the warning.<\/p>\n<p>var_off and the 32-bit range must always be consistent. There are two<br \/>\nways to keep the snapshot consistent:<\/p>\n<p>  1. sync var_off and r32 before the snapshot so they match, or<br \/>\n  2. leave r32 at its original (already consistent) value and blank it<br \/>\n     only after the snapshot.<\/p>\n<p>The whole point of sanitize_ptr_alu() is to insert a harmless masking<br \/>\nsequence that keeps the access in bounds under speculation, so the state<br \/>\nit snapshots should faithfully represent that. Take approach 2: move<br \/>\n__mark_reg32_unbounded() to after sanitize_ptr_alu(), so the speculative<br \/>\nsnapshot keeps the pointer&#8217;s original, consistent r32. The non-speculative<br \/>\npath is unchanged: r32 is still blanked before the offset is applied and<br \/>\nre-derived by reg_bounds_sync().<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In the Linux kernel, the following vulnerability has been resolved:<\/p>\n<p>bpf: Fix REG INVARIANTS VIOLATION on speculative pointer arithmetic<\/p>\n<p>Take the following unprivileged program as an example:<\/p>\n<p>\tr0 = <\/p>\n","protected":false},"template":"","meta":[],"categories":[],"tags":[],"class_list":["post-29305","vuln","type-vuln","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.54iter.cn\/index.php?rest_route=\/wp\/v2\/vuln\/29305","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=29305"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29305"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.54iter.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29305"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}