bpf, verifier: fix register type dump in xadd and st
authorDaniel Borkmann <daniel@iogearbox.net>
Sun, 21 Oct 2018 00:09:24 +0000 (02:09 +0200)
committerAlexei Starovoitov <ast@kernel.org>
Sun, 21 Oct 2018 06:13:32 +0000 (23:13 -0700)
commit2a159c6f82381a458bc56e7e202b6bee57a2ccb7
tree060b9cfd0b2af614168f72923c8e76800f76659c
parentc16ee04c9b305d57719344922c4d48379e206a79
bpf, verifier: fix register type dump in xadd and st

Using reg_type_str[insn->dst_reg] is incorrect since insn->dst_reg
contains the register number but not the actual register type. Add
a small reg_state() helper and use it to get to the type. Also fix
up the test_verifier test cases that have an incorrect errstr.

Fixes: 9d2be44a7f33 ("bpf: Reuse canonical string formatter for ctx errs")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
kernel/bpf/verifier.c
tools/testing/selftests/bpf/test_verifier.c