]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix signed_{sub,add32}_overflows type handling
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 19 Jan 2021 23:24:24 +0000 (00:24 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 20 Jan 2021 16:19:40 +0000 (17:19 +0100)
commiteaef8435c4a59921599487444a02593a0c38fb83
tree2f161e03d816093c3ee642a48cd920ab2a3288bf
parentf75321909b1fdd3b17fe69fef5065ee686ab1b55
bpf: Fix signed_{sub,add32}_overflows type handling

Fix incorrect signed_{sub,add32}_overflows() input types (and a related buggy
comment). It looks like this might have slipped in via copy/paste issue, also
given prior to 576785048b47 ("bpf: Verifier, do explicit ALU32 bounds tracking")
the signature of signed_sub_overflows() had s64 a and s64 b as its input args
whereas now they are truncated to s32. Thus restore proper types. Also, the case
of signed_add32_overflows() is not consistent to signed_sub32_overflows(). Both
have s32 as inputs, therefore align the former.

Fixes: 576785048b47 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Reported-by: De4dCr0w <sa516203@mail.ustc.edu.cn>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c