aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/mpi/mpi-sub-ui.c
diff options
context:
space:
mode:
authorAlexei Starovoitov <[email protected]>2025-07-07 15:32:34 +0000
committerAlexei Starovoitov <[email protected]>2025-07-07 15:32:35 +0000
commitdf4b1eebd8d1985d2016bc02fe3ea27c2e628e56 (patch)
tree240c4d8e51c21feca6c2118c8e964e62fac3f1be /lib/crypto/mpi/mpi-sub-ui.c
parentselftests/bpf: Set CONFIG_PACKET=y for selftests (diff)
parentselftests/bpf: Add Spectre v4 tests (diff)
downloadkernel-df4b1eebd8d1985d2016bc02fe3ea27c2e628e56.tar.gz
kernel-df4b1eebd8d1985d2016bc02fe3ea27c2e628e56.zip
Merge branch 'bpf-fix-and-test-aux-usage-after-do_check_insn'
Luis Gerhorst says: ==================== bpf: Fix and test aux usage after do_check_insn() Fix cur_aux()->nospec_result test after do_check_insn() referring to the to-be-analyzed (potentially unsafe) instruction, not the already-analyzed (safe) instruction. This might allow a unsafe insn to slip through on a speculative path. Create some tests from the reproducer [1]. Commit d6f1c85f2253 ("bpf: Fall back to nospec for Spectre v1") should not be in any stable kernel yet, therefore bpf-next should suffice. [1] https://lore.kernel.org/bpf/[email protected]/ Changes since v2: - Use insn_aux variable instead of introducing prev_aux() as suggested by Eduard (and therefore also drop patch 1) - v2: https://lore.kernel.org/bpf/[email protected]/ Changes since v1: - Fix compiler error due to missed rename of prev_insn_idx in first patch - v1: https://lore.kernel.org/bpf/[email protected]/ Changes since RFC: - Introduce prev_aux() as suggested by Alexei. For this, we must move the env->prev_insn_idx assignment to happen directly after do_check_insn(), for which I have created a separate commit. This patch could be simplified by using a local prev_aux variable as sugested by Eduard, but I figured one might find the new assignment-strategy easier to understand (before, prev_insn_idx and env->prev_insn_idx were out-of-sync for the latter part of the loop). Also, like this we do not have an additional prev_* variable that must be kept in-sync and the local variable's usage (old prev_insn_idx, new tmp) is much more local. If you think it would be better to not take the risk and keep the fix simple by just introducing the prev_aux variable, let me know. - Change WARN_ON_ONCE() to verifier_bug_if() as suggested by Alexei - Change assertion to check instruction is BPF_JMP[32] as suggested by Eduard - RFC: https://lore.kernel.org/bpf/[email protected]/ ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Alexei Starovoitov <[email protected]>
Diffstat (limited to 'lib/crypto/mpi/mpi-sub-ui.c')
0 files changed, 0 insertions, 0 deletions