[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ff240422-35b8-8001-819b-e819364c0dcf@iogearbox.net>
Date: Wed, 26 Jun 2019 16:31:43 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Jiong Wang <jiong.wang@...ronome.com>, alexei.starovoitov@...il.com
Cc: yauheni.kaliuta@...hat.com, bpf@...r.kernel.org,
netdev@...r.kernel.org, oss-drivers@...ronome.com
Subject: Re: [PATCH bpf] bpf: fix BPF_ALU32 | BPF_ARSH on BE arches
On 06/25/2019 06:41 PM, Jiong Wang wrote:
> Yauheni reported the following code do not work correctly on BE arches:
>
> ALU_ARSH_X:
> DST = (u64) (u32) ((*(s32 *) &DST) >> SRC);
> CONT;
> ALU_ARSH_K:
> DST = (u64) (u32) ((*(s32 *) &DST) >> IMM);
> CONT;
>
> and are causing failure of test_verifier test 'arsh32 on imm 2' on BE
> arches.
>
> The code is taking address and interpreting memory directly, so is not
> endianness neutral. We should instead perform standard C type casting on
> the variable. A u64 to s32 conversion will drop the high 32-bit and reserve
> the low 32-bit as signed integer, this is all we want.
>
> Fixes: 2dc6b100f928 ("bpf: interpreter support BPF_ALU | BPF_ARSH")
> Reported-by: Yauheni Kaliuta <yauheni.kaliuta@...hat.com>
> Reviewed-by: Jakub Kicinski <jakub.kicinski@...ronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@...ronome.com>
> Signed-off-by: Jiong Wang <jiong.wang@...ronome.com>
Applied, thanks!
Powered by blists - more mailing lists