bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yonghong Song <yhs@fb.com>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>, <davem@davemloft.net>
Cc: <daniel@iogearbox.net>, <john.fastabend@gmail.com>,
	<netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
	<kernel-team@fb.com>
Subject: Re: [PATCH bpf-next] bpf: Fix register equivalence tracking.
Date: Wed, 14 Oct 2020 22:48:51 -0700	[thread overview]
Message-ID: <0bfcf40e-7739-5435-7b83-33eda64d74d9@fb.com> (raw)
In-Reply-To: <4ec07471-5d8c-5aba-1f0e-65fe61c4d298@fb.com>



On 10/14/20 10:46 PM, Yonghong Song wrote:
> 
> 
> On 10/14/20 10:56 AM, Alexei Starovoitov wrote:
>> From: Alexei Starovoitov <ast@kernel.org>
>>
>> The 64-bit JEQ/JNE handling in reg_set_min_max() was clearing reg->id 
>> in either
>> true or false branch. In the case 'if (reg->id)' check was done on the 
>> other
>> branch the counter part register would have reg->id == 0 when called into
>> find_equal_scalars(). In such case the helper would incorrectly 
>> identify other
>> registers with id == 0 as equivalent and propagate the state incorrectly.
>> Fix it by preserving ID across reg_set_min_max().
>> In other words any kind of comparison operator on the scalar register
>> should preserve its ID to recognize:
>> r1 = r2
>> if (r1 == 20) {
>>    #1 here both r1 and r2 == 20
>> } else if (r2 < 20) {
>>    #2 here both r1 and r2 < 20
>> }
>>
>> The patch is addressing #1 case. The #2 was working correctly already.
>>
>> Fixes: 75748837b7e5 ("bpf: Propagate scalar ranges through register 
>> assignments.")
>> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
> 
> This fixed an issue appeared in our production system where packets may
> be incorrectly dropped.
> 
> Test-by: Yonghong Song <yhs@fb.com>
Sorry for typo, it should be:
   Tested-by: Yonghong Song <yhs@fb.com>

  reply	other threads:[~2020-10-15  6:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-14 17:56 [PATCH bpf-next] bpf: Fix register equivalence tracking Alexei Starovoitov
2020-10-14 23:09 ` Andrii Nakryiko
2020-10-15  4:04   ` John Fastabend
2020-10-15  4:19     ` Alexei Starovoitov
2020-10-15  4:27       ` John Fastabend
2020-10-15  4:33         ` Alexei Starovoitov
2020-10-15  5:23           ` John Fastabend
2020-10-15  5:46 ` Yonghong Song
2020-10-15  5:48   ` Yonghong Song [this message]
2020-10-15 14:10 ` patchwork-bot+netdevbpf

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=0bfcf40e-7739-5435-7b83-33eda64d74d9@fb.com \
    --to=yhs@fb.com \
    --cc=alexei.starovoitov@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=john.fastabend@gmail.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).