lkml.org 
[lkml]   [2019]   [May]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v2] bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE, BPF_JSLT, BPF_JSGE}
From
Date
On 04/27/2019 10:28 AM, 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 and adds a testcase in selftests/bpf for such bug.
>
> Signed-off-by: Wang YanQing <udknight@gmail.com>

Applied, thanks!

\
 
 \ /
  Last update: 2019-05-01 23:44    [W:0.032 / U:0.320 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site