bpf: Fix propagation of signed bounds from 64-bit min/max into 32-bit.

[ Upstream commit 388e2c0b97 ]

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: 3f50f132d8 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Yonghong Song <yhs@fb.com>
Link: https://lore.kernel.org/bpf/20211101222153.78759-2-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Alexei Starovoitov 2021-11-01 15:21:52 -07:00 коммит произвёл Greg Kroah-Hartman
Родитель d03a5b00a3
Коммит d55aca82dd
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -1406,7 +1406,7 @@ static void __reg_combine_32_into_64(struct bpf_reg_state *reg)
static bool __reg64_bound_s32(s64 a)
{
return a > S32_MIN && a < S32_MAX;
return a >= S32_MIN && a <= S32_MAX;
}
static bool __reg64_bound_u32(u64 a)