Skip to content

Commit

Permalink
bpf: Fix propagation of signed bounds from 64-bit min/max into 32-bit.
Browse files Browse the repository at this point in the history
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: 3f50f13 ("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
  • Loading branch information
Alexei Starovoitov authored and anakryiko committed Nov 2, 2021
1 parent b9979db commit 388e2c0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/bpf/verifier.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,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)
Expand Down

0 comments on commit 388e2c0

Please sign in to comment.