mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Borkmann <daniel@iogearbox.net>
To: zyf <zhouyangfan20s@ict.ac.cn>, bpf@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
	dsahern@kernel.org, Yonghong Song <yonghong.song@linux.dev>
Subject: Re: [PATCH] BPF : arch/x86/net/bpf_jit_comp.c : fix wrong condition code in jit compiler
Date: Wed, 25 Sep 2024 14:37:42 +0200	[thread overview]
Message-ID: <eebea88a-ebef-4bc7-9859-52820113318d@iogearbox.net> (raw)
In-Reply-To: <20240925082332.2849923-1-zhouyangfan20s@ict.ac.cn>

On 9/25/24 10:23 AM, zyf wrote:
> change 'case BPF_ALU64 | BPF_END | BPF_FROM_LE' to 'case BPF_ALU64 | BPF_END | BPF_FROM_BE'
>
> Signed-off-by: zyf <zhouyangfan20s@ict.ac.cn>
> ---
>   arch/x86/net/bpf_jit_comp.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/net/bpf_jit_comp.c b/arch/x86/net/bpf_jit_comp.c
> index 06b080b61aa5..7f954d76b3a6 100644
> --- a/arch/x86/net/bpf_jit_comp.c
> +++ b/arch/x86/net/bpf_jit_comp.c
> @@ -1786,7 +1786,7 @@ static int do_jit(struct bpf_prog *bpf_prog, int *addrs, u8 *image, u8 *rw_image
>   			break;
>   
>   		case BPF_ALU | BPF_END | BPF_FROM_BE:
> -		case BPF_ALU64 | BPF_END | BPF_FROM_LE:
> +		case BPF_ALU64 | BPF_END | BPF_FROM_BE:
>   			switch (imm32) {
>   			case 16:
>   				/* Emit 'ror %ax, 8' to swap lower 2 bytes */
Please elaborate on the exact issue you've encountered. Right now it looks
like you did this change just based on code review but not based on a real
world bug?

BPF_ALU64 | BPF_END | BPF_FROM_LE instruction is unconditonal swap,
see also commit 0845c3db7bf5c4ceb ("bpf: Support new unconditional bswap 
instruction").
As it stands your change additionally breaks BPF selftests.

      reply	other threads:[~2024-09-25 12:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-25  8:23 zyf
2024-09-25 12:37 ` Daniel Borkmann [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=eebea88a-ebef-4bc7-9859-52820113318d@iogearbox.net \
    --to=daniel@iogearbox.net \
    --cc=bpf@vger.kernel.org \
    --cc=dsahern@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yonghong.song@linux.dev \
    --cc=zhouyangfan20s@ict.ac.cn \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®