From: Daniel Borkmann <daniel@iogearbox.net>
To: Wang YanQing <udknight@gmail.com>,
ast@kernel.org, davem@davemloft.net, kuznet@ms2.inr.ac.ru,
tglx@linutronix.de, netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE, BPF_JSLT, BPF_JSGE}
Date: Wed, 1 May 2019 23:44:09 +0200 [thread overview]
Message-ID: <aca27db2-5c16-6bf8-e601-be8b42678cd4@iogearbox.net> (raw)
In-Reply-To: <20190427082826.GA16311@udknight>
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!
prev parent reply other threads:[~2019-05-01 21:44 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-27 8:28 [PATCH v2] bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE, BPF_JSLT, BPF_JSGE} Wang YanQing
2019-05-01 21:44 ` 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=aca27db2-5c16-6bf8-e601-be8b42678cd4@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=kuznet@ms2.inr.ac.ru \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=udknight@gmail.com \
/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