summaryrefslogtreecommitdiff
path: root/tools/perf/scripts/python
diff options
context:
space:
mode:
authorYunhui Cui <cuiyunhui@bytedance.com>2026-10-22 16:32:12 +0800
committerPaul Walmsley <pjw@kernel.org>2026-11-04 01:55:51 -0700
commit807b09be9c8f234ce758bcf43101f34e0a036b83 (patch)
tree4d4a0bccf742a6a220533df63d994e5998b2be7e /tools/perf/scripts/python
parent6628e7d4c6b25c8d18f1345e3a20d21829aae7e4 (diff)
riscv: Fix SR_SUM leakage across context switches
__switch_to() saves the sstatus value of prev and restores the SR_SUM bit of next with csrs. However, csrs only sets bits. If prev has SR_SUM set and next has SR_SUM clear in its saved state, the old SR_SUM bit remains set in sstatus. This lets next run with user memory access enabled even though its saved SR_SUM state is clear. Use csrrc to save the sstatus value of prev and clear SR_SUM from the live CSR before restoring the saved SR_SUM state of next. This keeps prev's SR_SUM state intact, while preventing it from leaking to next. Fixes: 788aa64c01f1 ("riscv: save the SR_SUM status over switches") Cc: stable@vger.kernel.org Signed-off-by: Yunhui Cui <cuiyunhui@bytedance.com> Reviewed-by: Jisheng Zhang <jszhang@kernel.org> Reviewed-by: Andy Chiu <tchiu@tenstorrent.com> Reviewed-by: Yicong Yang <yang.yicong@picoheart.com> Link: https://patch.msgid.link/20261022083212.84721-1-cuiyunhui@bytedance.com Signed-off-by: Paul Walmsley <pjw@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions