[PW_SID:1085429] [RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator#1813
[PW_SID:1085429] [RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator#1813linux-riscv-bot wants to merge 3 commits into
Conversation
…_TYPED_FUNC_START After commit 67bdd7b ("riscv: Split out measure_cycles() for reuse") and commit c03ad15 ("riscv: Reuse measure_cycles() in check_vector_unaligned_access()"), there are CFI failure when booting kernels with CONFIG_CFI=y: CFI failure at measure_cycles+0x38/0xe0 (target: __riscv_copy_words_unaligned+0x0/0x50; expected type: ...) CFI failure at measure_cycles+0x38/0xe0 (target: __riscv_copy_vec_words_unaligned+0x0/0x24; expected type: ...) The __riscv_copy_*_unaligned() functions are now called indirectly but they are not defined with SYM_TYPED_FUNC_START, which is required for assembly functions called indirectly from C to pass CFI checking. Switch to SYM_TYPED_FUNC_START to clear up the CFI failures. Fixes: 67bdd7b ("riscv: Split out measure_cycles() for reuse") Fixes: c03ad15 ("riscv: Reuse measure_cycles() in check_vector_unaligned_access()") Signed-off-by: Nathan Chancellor <nathan@kernel.org> Reviewed-by: Sami Tolvanen <samitolvanen@google.com> Reviewed-by: Nam Cao <namcao@linutronix.de> Link: https://patch.msgid.link/20260406-measure_cycles-cfi-failure-v1-1-03e0234ae02f@kernel.org Signed-off-by: Paul Walmsley <pjw@kernel.org>
RISC-V probes the number of implemented ASID bits in SATP on the boot hart and enables the ASID allocator based on that result. However, the privileged spec allows harts to implement fewer ASID bits by hardwiring the upper bits to zero. If a secondary hart implements fewer ASID bits than the boot hart while the ASID allocator is enabled, different Linux ASIDs may alias on that hart. This can allow stale TLB entries to survive and potentially corrupt memory. Verify the number of implemented ASID bits on each CPU as it comes online, and refuse to online CPUs that support fewer ASID bits than the boot CPU. Signed-off-by: Shengming Hu <hu.shengming@zte.com.cn> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
|
Patch 1: "[RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator" |
f190ec6 to
2c3b264
Compare
PR for series 1085429 applied to workflow__riscv__fixes
Name: [RESEND] riscv: mm: Verify per-hart ASID bits when using ASID allocator
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1085429
Version: 1