From: David Laight <david.laight.linux@gmail.com>
To: Johan Almbladh <johan.almbladh@anyfinetworks.com>
Cc: tsbogend@alpha.franken.de, ast@kernel.org, daniel@iogearbox.net,
andrii@kernel.org, eddyz87@gmail.com, memxor@gmail.com,
paulburton@kernel.org, main.kalliope@gmail.com,
martin.lau@linux.dev, song@kernel.org, yonghong.song@linux.dev,
jolsa@kernel.org, emil@etsalapatis.com, ihor.solodrai@linux.dev,
linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, philmd@oss.qualcomm.com
Subject: Re: [PATCH bpf 1/2] bpf, mips: Fix immediate JMP JEQ/JNE on MIPS32
Date: Thu, 24 Sep 2026 09:22:39 +0100 [thread overview]
Message-ID: <20260924092239.0743b082@pumpkin> (raw)
In-Reply-To: <20260923105158.3514342-1-johan.almbladh@anyfinetworks.com>
On Wed, 23 Sep 2026 12:51:57 +0200
Johan Almbladh <johan.almbladh@anyfinetworks.com> wrote:
> An addu instruction was emitted instead of addiu, causing the immediate
> value 1 to be interpreted as register $at. This made the comparison
> result invalid when the immediate operand was negative. Note that $at
> is mapped to BPF_REG_AX, which is used for constant blinding.
^^ building??
David
>
> Fix the instruction to use the immediate form.
>
> Found with test_bpf on MIPS32r1 emulated by QEMU.
>
> Fixes: eb63cfcd2ee8 ("mips, bpf: Add eBPF JIT for 32-bit MIPS")
> Signed-off-by: Johan Almbladh <johan.almbladh@anyfinetworks.com>
> ---
> arch/mips/net/bpf_jit_comp32.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/mips/net/bpf_jit_comp32.c b/arch/mips/net/bpf_jit_comp32.c
> index 40a878b672f5..15a2a153dc87 100644
> --- a/arch/mips/net/bpf_jit_comp32.c
> +++ b/arch/mips/net/bpf_jit_comp32.c
> @@ -1111,7 +1111,7 @@ static void emit_jmp_i64(struct jit_context *ctx,
> emit(ctx, xor, tmp, lo(dst), tmp);
> }
> if (imm < 0) { /* Compare sign extension */
> - emit(ctx, addu, MIPS_R_T9, hi(dst), 1);
> + emit(ctx, addiu, MIPS_R_T9, hi(dst), 1);
> emit(ctx, or, tmp, tmp, MIPS_R_T9);
> } else { /* Compare zero extension */
> emit(ctx, or, tmp, tmp, hi(dst));
prev parent reply other threads:[~2026-09-24 8:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-23 10:51 [PATCH bpf 1/2] bpf, mips: Fix immediate JMP JEQ/JNE on MIPS32 Johan Almbladh
2026-09-23 10:51 ` [PATCH bpf 2/2] bpf, mips: Fix BSWAP 32 and 16 on MIPS64 Johan Almbladh
2026-09-24 2:00 ` [PATCH bpf 1/2] bpf, mips: Fix immediate JMP JEQ/JNE on MIPS32 patchwork-bot+netdevbpf
2026-09-24 8:22 ` David Laight [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260924092239.0743b082@pumpkin \
--to=david.laight.linux@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=emil@etsalapatis.com \
--cc=ihor.solodrai@linux.dev \
--cc=johan.almbladh@anyfinetworks.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@vger.kernel.org \
--cc=main.kalliope@gmail.com \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=paulburton@kernel.org \
--cc=philmd@oss.qualcomm.com \
--cc=song@kernel.org \
--cc=tsbogend@alpha.franken.de \
--cc=yonghong.song@linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.