{"id":65877,"date":"2025-07-09T16:32:49","date_gmt":"2025-07-09T13:02:49","guid":{"rendered":"https:\/\/afaghhosting.net\/blog\/cve-2025-38261-linux-risc-v-sr_sum-status-vulnerability\/"},"modified":"2025-07-09T16:32:49","modified_gmt":"2025-07-09T13:02:49","slug":"cve-2025-38261-linux-risc-v-sr_sum-status-vulnerability","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/cve-2025-38261-linux-risc-v-sr_sum-status-vulnerability\/","title":{"rendered":"CVE-2025-38261 &#8211; Linux RISC-V SR_SUM Status Vulnerability"},"content":{"rendered":"<p><strong>CVE ID : <\/strong>CVE-2025-38261<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>riscv: save the SR_SUM status over switches<\/p>\n<p>When threads\/tasks are switched we need to ensure the old execution&#8217;s<br \/>\nSR_SUM state is saved and the new thread has the old SR_SUM state<br \/>\nrestored.<\/p>\n<p>The issue was seen under heavy load especially with the syz-stress tool<br \/>\nrunning, with crashes as follows in schedule_tail:<\/p>\n<p>Unable to handle kernel access to user memory without uaccess routines<br \/>\nat virtual address 000000002749f0d0<br \/>\nOops [#1]\nModules linked in:<br \/>\nCPU: 1 PID: 4875 Comm: syz-executor.0 Not tainted<br \/>\n5.12.0-rc2-syzkaller-00467-g0d7588ab9ef9 #0<br \/>\nHardware name: riscv-virtio,qemu (DT)<br \/>\nepc : schedule_tail+0x72\/0xb2 kernel\/sched\/core.c:4264<br \/>\n ra : task_pid_vnr include\/linux\/sched.h:1421 [inline]\n ra : schedule_tail+0x70\/0xb2 kernel\/sched\/core.c:4264<br \/>\nepc : ffffffe00008c8b0 ra : ffffffe00008c8ae sp : ffffffe025d17ec0<br \/>\n gp : ffffffe005d25378 tp : ffffffe00f0d0000 t0 : 0000000000000000<br \/>\n t1 : 0000000000000001 t2 : 00000000000f4240 s0 : ffffffe025d17ee0<br \/>\n s1 : 000000002749f0d0 a0 : 000000000000002a a1 : 0000000000000003<br \/>\n a2 : 1ffffffc0cfac500 a3 : ffffffe0000c80cc a4 : 5ae9db91c19bbe00<br \/>\n a5 : 0000000000000000 a6 : 0000000000f00000 a7 : ffffffe000082eba<br \/>\n s2 : 0000000000040000 s3 : ffffffe00eef96c0 s4 : ffffffe022c77fe0<br \/>\n s5 : 0000000000004000 s6 : ffffffe067d74e00 s7 : ffffffe067d74850<br \/>\n s8 : ffffffe067d73e18 s9 : ffffffe067d74e00 s10: ffffffe00eef96e8<br \/>\n s11: 000000ae6cdf8368 t3 : 5ae9db91c19bbe00 t4 : ffffffc4043cafb2<br \/>\n t5 : ffffffc4043cafba t6 : 0000000000040000<br \/>\nstatus: 0000000000000120 badaddr: 000000002749f0d0 cause:<br \/>\n000000000000000f<br \/>\nCall Trace:<br \/>\n[] schedule_tail+0x72\/0xb2 kernel\/sched\/core.c:4264<br \/>\n[] ret_from_exception+0x0\/0x14<br \/>\nDumping ftrace buffer:<br \/>\n   (ftrace buffer empty)<br \/>\n&#8212;[ end trace b5f8f9231dc87dda ]&#8212;<\/p>\n<p>The issue comes from the put_user() in schedule_tail<br \/>\n(kernel\/sched\/core.c) doing the following:<\/p>\n<p>asmlinkage __visible void schedule_tail(struct task_struct *prev)<br \/>\n{<br \/>\n&#8230;<br \/>\n        if (current-&gt;set_child_tid)<br \/>\n                put_user(task_pid_vnr(current), current-&gt;set_child_tid);<br \/>\n&#8230;<br \/>\n}<\/p>\n<p>the put_user() macro causes the code sequence to come out as follows:<\/p>\n<p>1:\t__enable_user_access()<br \/>\n2:\treg = task_pid_vnr(current);<br \/>\n3:\t*current-&gt;set_child_tid = reg;<br \/>\n4:\t__disable_user_access()<\/p>\n<p>The problem is that we may have a sleeping function as argument which<br \/>\ncould clear SR_SUM causing the panic above. This was fixed by<br \/>\nevaluating the argument of the put_user() macro outside the user-enabled<br \/>\nsection in commit 285a76bb2cf5 (&#8220;riscv: evaluate put_user() arg before<br \/>\nenabling user access&#8221;)&#8221;<\/p>\n<p>In order for riscv to take advantage of unsafe_get\/put_XXX() macros and<br \/>\nto avoid the same issue we had with put_user() and sleeping functions we<br \/>\nmust ensure code flow can go through switch_to() from within a region of<br \/>\ncode with SR_SUM enabled and come back with SR_SUM still enabled. This<br \/>\npatch addresses the problem allowing future work to enable full use of<br \/>\nunsafe_get\/put_XXX() macros without needing to take a CSR bit flip cost<br \/>\non every access. Make switch_to() save and restore SR_SUM.<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-38261 Published : July 9, 2025, 11:15 a.m. | 49\u00a0minutes ago Description : In the Linux kernel, the following vulnerability has been resolved: riscv: save the SR_SUM status over switches When threads\/tasks are switched we need to ensure the old execution&#8217;s SR_SUM state is saved and the new thread has the old &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-65877","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/65877","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=65877"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/65877\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=65877"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=65877"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=65877"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}