Commit 03254727 authored by Paul Chaignon's avatar Paul Chaignon Committed by Alexei Starovoitov
Browse files

bpf: Avoid warning on unexpected map for tail call



Before handling the tail call in record_func_key(), we check that the
map is of the expected type and log a verifier error if it isn't. Such
an error however doesn't indicate anything wrong with the verifier. The
check for map<>func compatibility is done after record_func_key(), by
check_map_func_compatibility().

Therefore, this patch logs the error as a typical reject instead of a
verifier error.

Fixes: d2e4c1e6 ("bpf: Constant map key tracking for prog array pokes")
Fixes: 0df1a55a ("bpf: Warn on internal verifier errors")
Reported-by: default avatar <syzbot+efb099d5833bca355e51@syzkaller.appspotmail.com>
Signed-off-by: default avatarPaul Chaignon <paul.chaignon@gmail.com>
Acked-by: default avatarEduard Zingerman <eddyz87@gmail.com>
Link: https://lore.kernel.org/r/1f395b74e73022e47e04a31735f258babf305420.1751578055.git.paul.chaignon@gmail.com


Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
parent 71b4a995
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -11082,8 +11082,8 @@ record_func_key(struct bpf_verifier_env *env, struct bpf_call_arg_meta *meta,
	if (func_id != BPF_FUNC_tail_call)
		return 0;
	if (!map || map->map_type != BPF_MAP_TYPE_PROG_ARRAY) {
		verifier_bug(env, "expected array map for tail call");
		return -EFAULT;
		verbose(env, "expected prog array map for tail call");
		return -EINVAL;
	}
	reg = &regs[BPF_REG_3];