From: Alexei Starovoitov <ast@kernel.org>
Before this fix:
166: (b5) if r2 <= 0x1 goto pc+22
from 166 to 189: R2=invP(id=1,umax_value=1,var_off=(0x0; 0xffffffff))
After this fix:
166: (b5) if r2 <= 0x1 goto pc+22
from 166 to 189: R2=invP(id=1,umax_value=1,var_off=(0x0; 0x1))
While processing BPF_JLE the reg_set_min_max() would set true_reg->umax_value = 1
and call __reg_combine_64_into_32(true_reg).
Without the fix it would not pass the condition:
if (__reg64_bound_u32(reg->umin_value) && __reg64_bound_u32(reg->umax_value))
since umin_value == 0 at this point.
Before commit 10bf4e83167c the umin was incorrectly ingored.
The commit 10bf4e83167c fixed the correctness issue, but pessimized
propagation of 64-bit min max into 32-bit min max and corresponding var_off.
Fixes: 10bf4e83167c ("bpf: Fix propagation of 32 bit unsigned bounds from 64 bit bounds")
Acked-by: Yonghong Song <redacted>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
kernel/bpf/verifier.c | 2 +-
tools/testing/selftests/bpf/verifier/array_access.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
From: Alexei Starovoitov <ast@kernel.org>
Similar to unsigned bounds propagation fix signed bounds.
The 'Fixes' tag is a hint. There is no security bug here.
The verifier was too conservative.
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
kernel/bpf/verifier.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
From: Yonghong Song <hidden> Date: 2021-11-01 23:03:57
On 11/1/21 3:21 PM, Alexei Starovoitov wrote:
From: Alexei Starovoitov <ast@kernel.org>
Similar to unsigned bounds propagation fix signed bounds.
The 'Fixes' tag is a hint. There is no security bug here.
The verifier was too conservative.
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
The change looks good. Should a new test_verifier test be added
to exercise the new change?
On Mon, Nov 1, 2021 at 4:03 PM Yonghong Song [off-list ref] wrote:
On 11/1/21 3:21 PM, Alexei Starovoitov wrote:
quoted
From: Alexei Starovoitov <ast@kernel.org>
Similar to unsigned bounds propagation fix signed bounds.
The 'Fixes' tag is a hint. There is no security bug here.
The verifier was too conservative.
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
The change looks good. Should a new test_verifier test be added
to exercise the new change?
I think manually string comparing output the way VERBOSE_ACCEPT is doing
is an overkill here.
The real test case in .c will take some time to craft.
From: Yonghong Song <hidden> Date: 2021-11-01 23:12:15
On 11/1/21 4:06 PM, Alexei Starovoitov wrote:
On Mon, Nov 1, 2021 at 4:03 PM Yonghong Song [off-list ref] wrote:
quoted
On 11/1/21 3:21 PM, Alexei Starovoitov wrote:
quoted
From: Alexei Starovoitov <ast@kernel.org>
Similar to unsigned bounds propagation fix signed bounds.
The 'Fixes' tag is a hint. There is no security bug here.
The verifier was too conservative.
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
The change looks good. Should a new test_verifier test be added
to exercise the new change?
I think manually string comparing output the way VERBOSE_ACCEPT is doing
is an overkill here.
The real test case in .c will take some time to craft.
Okay. Sounds good to me.
Acked-by: Yonghong Song <redacted>
Hello:
This series was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko [off-list ref]:
On Mon, 1 Nov 2021 15:21:51 -0700 you wrote:
From: Alexei Starovoitov <ast@kernel.org>
Before this fix:
166: (b5) if r2 <= 0x1 goto pc+22
from 166 to 189: R2=invP(id=1,umax_value=1,var_off=(0x0; 0xffffffff))
After this fix:
166: (b5) if r2 <= 0x1 goto pc+22
from 166 to 189: R2=invP(id=1,umax_value=1,var_off=(0x0; 0x1))
[...]