[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0bfcf40e-7739-5435-7b83-33eda64d74d9@fb.com>
Date: Wed, 14 Oct 2020 22:48:51 -0700
From: Yonghong Song <yhs@...com>
To: Alexei Starovoitov <alexei.starovoitov@...il.com>,
<davem@...emloft.net>
CC: <daniel@...earbox.net>, <john.fastabend@...il.com>,
<netdev@...r.kernel.org>, <bpf@...r.kernel.org>,
<kernel-team@...com>
Subject: Re: [PATCH bpf-next] bpf: Fix register equivalence tracking.
On 10/14/20 10:46 PM, Yonghong Song wrote:
>
>
> On 10/14/20 10:56 AM, Alexei Starovoitov wrote:
>> From: Alexei Starovoitov <ast@...nel.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@...nel.org>
>
> This fixed an issue appeared in our production system where packets may
> be incorrectly dropped.
>
> Test-by: Yonghong Song <yhs@...com>
Sorry for typo, it should be:
Tested-by: Yonghong Song <yhs@...com>
Powered by blists - more mailing lists