[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <6735a15f-57af-2d09-016e-d81b1877eca6@iogearbox.net>
Date: Fri, 26 Apr 2019 14:08:18 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Wang YanQing <udknight@...il.com>, ast@...nel.org,
davem@...emloft.net, kuznet@....inr.ac.ru, tglx@...utronix.de,
netdev@...r.kernel.org, bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE,
BPF_JSLT, BPF_JSGE}
Hi Wang,
On 04/26/2019 12:56 PM, Wang YanQing wrote:
> The current method to compare 64-bit numbers for conditional jump is:
>
> 1) Compare the high 32-bit first.
>
> 2) If the high 32-bit isn't the same, then goto step 4.
>
> 3) Compare the low 32-bit.
>
> 4) Check the desired condition.
>
> This method is right for unsigned comparison, but it is buggy for signed
> comparison, because it does signed comparison for low 32-bit too.
>
> There is only one sign bit in 64-bit number, that is the MSB in the 64-bit
> number, it is wrong to treat low 32-bit as signed number and do the signed
> comparison for it.
>
> This patch fixes the bug.
>
> Signed-off-by: Wang YanQing <udknight@...il.com>
I presume this issue has coverage in our BPF kselftest suite, right? (If
not, please also add a test into the test_verifier tool.)
Thanks,
Daniel
Powered by blists - more mailing lists