Piotr Krysiuk f3b35b68f6 bpf: Simplify alu_limit masking for pointer arithmetic
stable inclusion
from linux-4.19.182
commit 087299234e6fa5d2e611df782602dbd9864957b0
category: bugfix
bugzilla: NA
CVE: NA

--------------------------------

commit b5871dca250cd391885218b99cc015aca1a51aea upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Yu Changchun <yuchangchun1@huawei.com>
2021-05-31 17:14:54 +08:00
..
2020-09-17 13:45:31 +02:00
2019-12-13 08:51:11 +01:00
2019-12-01 09:17:17 +01:00
2018-04-27 14:34:51 +02:00
2020-03-25 08:06:13 +01:00
2019-01-13 09:51:06 +01:00
2020-04-17 10:48:47 +02:00
2018-07-03 09:20:44 +02:00
2020-01-09 10:18:59 +01:00