acrn-kernel/kernel/bpf
David Vernet 30ca523f28 bpf: Fix verifier log for async callback return values
[ Upstream commit 829955981c ]

The verifier, as part of check_return_code(), verifies that async
callbacks such as from e.g. timers, will return 0. It does this by
correctly checking that R0->var_off is in tnum_const(0), which
effectively checks that it's in a range of 0. If this condition fails,
however, it prints an error message which says that the value should
have been in (0x0; 0x1). This results in possibly confusing output such
as the following in which an async callback returns 1:

  At async callback the register R0 has value (0x1; 0x0) should have been in (0x0; 0x1)

The fix is easy -- we should just pass the tnum_const(0) as the correct
range to verbose_invalid_scalar(), which will then print the following:

  At async callback the register R0 has value (0x1; 0x0) should have been in (0x0; 0x0)

Fixes: bfc6bb74e4 ("bpf: Implement verifier support for validation of async callbacks.")
Signed-off-by: David Vernet <void@manifault.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20231009161414.235829-1-void@manifault.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-10-19 23:08:53 +02:00
..
preload
Kconfig
Makefile
arraymap.c
bloom_filter.c
bpf_inode_storage.c
bpf_iter.c
bpf_local_storage.c
bpf_lru_list.c
bpf_lru_list.h
bpf_lsm.c
bpf_struct_ops.c
bpf_struct_ops_types.h
bpf_task_storage.c
btf.c bpf: Fix an error in verifying a field in a union 2023-09-13 09:42:30 +02:00
cgroup.c
cgroup_iter.c
core.c
cpumap.c bpf, cpumap: Make sure kthread is running before map update returns 2023-08-11 12:08:23 +02:00
devmap.c
disasm.c
disasm.h
dispatcher.c
hashtab.c
helpers.c
inode.c
link_iter.c
local_storage.c
lpm_trie.c
map_in_map.c
map_in_map.h
map_iter.c
memalloc.c
mmap_unlock_work.h
net_namespace.c
offload.c
percpu_freelist.c
percpu_freelist.h
prog_iter.c
queue_stack_maps.c bpf: Avoid deadlock when using queue and stack maps from NMI 2023-10-06 14:56:35 +02:00
reuseport_array.c
ringbuf.c
stackmap.c
syscall.c bpf: Assign bpf_tramp_run_ctx::saved_run_ctx before recursion check. 2023-09-19 12:28:03 +02:00
sysfs_btf.c
task_iter.c
tnum.c
trampoline.c bpf: Assign bpf_tramp_run_ctx::saved_run_ctx before recursion check. 2023-09-19 12:28:03 +02:00
verifier.c bpf: Fix verifier log for async callback return values 2023-10-19 23:08:53 +02:00