]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Mark PTR_TO_FUNC register initially with zero offset
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 14 Jan 2022 13:58:36 +0000 (13:58 +0000)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 19 Jan 2022 00:21:29 +0000 (01:21 +0100)
commit62a01c4e7204fef0c0955b8af36f9b148c4bd422
treea88683f17fd5614cf5db1537a18a8ff3701a3229
parent3e83f990d272ce46c31e5f4ec3ffd27b8f873964
bpf: Mark PTR_TO_FUNC register initially with zero offset

Similar as with other pointer types where we use ldimm64, clear the register
content to zero first, and then populate the PTR_TO_FUNC type and subprogno
number. Currently this is not done, and leads to reuse of stale register
tracking data.

Given for special ldimm64 cases we always clear the register offset, make it
common for all cases, so it won't be forgotten in future.

Fixes: 359bfbf9bf1e ("bpf: Add bpf_for_each_map_elem() helper")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c