[PW_SID:1158337] Fix timed may_goto with private stacks - #2595
[PW_SID:1158337] Fix timed may_goto with private stacks#2595linux-riscv-bot wants to merge 7 commits into
Conversation
timed may_goto passes a stack offset to the architecture trampoline, which reconstructs the counter pointer from its BPF frame pointer. This breaks when the JIT uses a private stack with a different frame pointer. Resolve the counter pointer in the fixup using BPF_REG_FP and pass the pointer through BPF_REG_AX. Account for the extra instruction in the internal branch offsets. Fixes: e723608 ("bpf: Add verifier support for timed may_goto") Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/ Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through BPF_REG_AX instead of a stack offset. Use the pointer directly rather than adding it to RBP. This preserves the private-stack address selected by the JIT through R9. Fixes: 2fb7618 ("bpf, x86: Add x86 JIT support for timed may_goto") Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/ Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through BPF_REG_AX instead of a stack offset. Copy the pointer directly into the first argument register rather than adding it to the BPF frame pointer again. Fixes: 1617537 ("bpf, arm64: Add JIT support for timed may_goto") Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/ Assisted-by: Copilot:gpt-5.6-sol Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through BPF_REG_AX instead of a stack offset. Copy the pointer directly into the first argument register rather than adding it to the BPF frame pointer again. Fixes: b55b6b9 ("powerpc64/bpf: Add powerpc64 JIT support for timed may_goto") Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/ Assisted-by: Copilot:gpt-5.6-sol Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through BPF_REG_AX instead of a stack offset. Copy the pointer directly into the first argument register rather than adding it to the BPF frame pointer again. Fixes: 6ef8ff2 ("bpf, riscv: Add support for timed may_goto") Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/ Assisted-by: Copilot:gpt-5.6-sol Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
The timed may_goto fixup now passes the resolved counter pointer through BPF_REG_AX instead of a stack offset and BPF frame pointer pair. Copy the pointer directly into the first argument register and update the special calling convention documentation. Fixes: b8efa81 ("s390/bpf: Add s390 JIT support for timed may_goto") Reported-by: Jeremy Jean <jeremy.jean@oss.cyber.gouv.fr> Link: https://lore.kernel.org/all/20260824213158.3755932-2-Jeremy.Jean@oss.cyber.gouv.fr/ Assisted-by: Copilot:gpt-5.6-sol Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Add private_stack_timed_may_goto() with enough stack usage to select a private stack. Check that the JIT uses the private-stack frame pointer when constructing the pointer passed to the architecture trampoline. Update the translated instruction expectations in may_goto_batch_2(), may_goto_interaction_x86_64(), and may_goto_interaction() for the additional pointer construction instruction and adjusted branch offsets. Signed-off-by: Siddharth Chintamaneni <sidchintamaneni@gmail.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 1: "[bpf-next,v1,1/7] bpf: Fix timed may_goto stack pointer for private stacks" |
|
Patch 2: "[bpf-next,v1,2/7] bpf, x86: Use resolved pointer for timed may_goto" |
|
Patch 2: "[bpf-next,v1,2/7] bpf, x86: Use resolved pointer for timed may_goto" |
PR for series 1158337 applied to workflow__riscv__fixes
Name: Fix timed may_goto with private stacks
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1158337
Version: 1