bpf: Do not mark insn as seen under speculative path verification
authorDaniel Borkmann <daniel@iogearbox.net>
Fri, 28 May 2021 13:47:27 +0000 (13:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Jun 2021 12:42:49 +0000 (14:42 +0200)
commit8c82c52d1de931532200b447df8b4fc92129cfd9
treeebee23fe6169bb6ba23cfc95849f9524daf94c46
parente9d271731d21647f8f9e9a261582cf47b868589a
bpf: Do not mark insn as seen under speculative path verification

[ Upstream commit fe9a5ca7e370e613a9a75a13008a3845ea759d6e ]

... in such circumstances, we do not want to mark the instruction as seen given
the goal is still to jmp-1 rewrite/sanitize dead code, if it is not reachable
from the non-speculative path verification. We do however want to verify it for
safety regardless.

With the patch as-is all the insns that have been marked as seen before the
patch will also be marked as seen after the patch (just with a potentially
different non-zero count). An upcoming patch will also verify paths that are
unreachable in the non-speculative domain, hence this extension is needed.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Reviewed-by: Benedict Schlueter <benedict.schlueter@rub.de>
Reviewed-by: Piotr Krysiuk <piotras@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/verifier.c