bpf: enable access to ax register also from verifier rewrite
authorDaniel Borkmann <daniel@iogearbox.net>
Mon, 28 Jan 2019 20:23:23 +0000 (21:23 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 31 Jan 2019 07:15:44 +0000 (08:15 +0100)
commit74d3c0442d9c260bf72d99a554d03200a077c4da
tree464129411f85e98ea571811de460fbffa182a899
parentbab8056a3537acc097bf02f16219d45aa0842f46
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