Re: [PATCH bpf-next 1/5] bpf, x86: Add support for BPF_MOVSX in the i386 JIT
From: Alexei Starovoitov
Date: Sat Sep 19 2026 - 01:45:08 EST
On Mon, Sep 14, 2026 at 7:14 PM Nicholas Dudar <main.kalliope@xxxxxxxxx> wrote:
>
> The i386 JIT lowers register BPF_MOVSX as an ordinary move because
> do_jit() does not inspect insn->off. The generated code therefore copies
> the source instead of sign-extending the selected low bits. Context-access
> conversion can also introduce MOVSX while lowering signed loads, so
> rejecting BPF_MEMSX does not protect those paths.
>
> Stage the source low word in EAX and use the native byte and word
> sign-extension instructions. Derive the high word from the sign bit for
> ALU64 and retain verifier-managed zero extension for ALU32.
>
> Assisted-by: Codex:gpt-6
> Signed-off-by: Nicholas Dudar <main.kalliope@xxxxxxxxx>
> ---
> arch/x86/net/bpf_jit_comp32.c | 51 +++++++++++++++++++++++++++++++++++
> 1 file changed, 51 insertions(+)
>
> diff --git a/arch/x86/net/bpf_jit_comp32.c b/arch/x86/net/bpf_jit_comp32.c
I don't think anyone cares to spend their time or their tokens on the
dead platform.
pw-bot: cr