bpf: enable access to ax register also from verifier rewrite
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 28 Jan 2019 20:28:23 +0000 (21:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 07:14:40 +0000 (08:14 +0100)
commit232ac70dd38bfae4899460c342aae7aa0a36aa64
tree676716da7031a198004141bf9bde9c34598f94c6
parentb855e310374063360af5fb3bbbd0cc66ca189dc0
bpf: enable access to ax register also from verifier rewrite

[ commit 9b73bfdd08e73231d6a90ae6db4b46b3fbf56c30 upstream ]

Right now we are using BPF ax register in JIT for constant blinding as
well as in interpreter as temporary variable. Verifier will not be able
to use it simply because its use will get overridden from the former in
bpf_jit_blind_insn(). However, it can be made to work in that blinding
will be skipped if there is prior use in either source or destination
register on the instruction. Taking constraints of ax into account, the
verifier is then open to use it in rewrites under some constraints. Note,
ax register already has mappings in every eBPF JIT.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/filter.h
kernel/bpf/core.c