]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Simplify alu_limit masking for pointer arithmetic
authorPiotr Krysiuk <piotras@gmail.com>
Tue, 16 Mar 2021 07:26:25 +0000 (08:26 +0100)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 17 Mar 2021 18:13:22 +0000 (19:13 +0100)
commit9aaf1c37b62a78cd59ece43d33f1092a7d1a4b4a
treeeeac1e5ab22d5413d02cd040155c8d4c8641634a
parent253ad08e17987d296d2ce18f5524ecac1e97bec9
bpf: Simplify alu_limit masking for pointer arithmetic

Instead of having the mov32 with aux->alu_limit - 1 immediate, move this
operation to retrieve_ptr_limit() instead to simplify the logic and to
allow for subsequent sanity boundary checks inside retrieve_ptr_limit().
This avoids in future that at the time of the verifier masking rewrite
we'd run into an underflow which would not sign extend due to the nature
of mov32 instruction.

Signed-off-by: Piotr Krysiuk <piotras@gmail.com>
Co-developed-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c