linux/kernel/bpf
Andrii Nakryiko 81335f90e8 bpf: unconditionally reset backtrack_state masks on global func exit
In mark_chain_precision() logic, when we reach the entry to a global
func, it is expected that R1-R5 might be still requested to be marked
precise. This would correspond to some integer input arguments being
tracked as precise. This is all expected and handled as a special case.

What's not expected is that we'll leave backtrack_state structure with
some register bits set. This is because for subsequent precision
propagations backtrack_state is reused without clearing masks, as all
code paths are carefully written in a way to leave empty backtrack_state
with zeroed out masks, for speed.

The fix is trivial, we always clear register bit in the register mask, and
then, optionally, set reg->precise if register is SCALAR_VALUE type.

Reported-by: Chris Mason <clm@meta.com>
Fixes: be2ef81615 ("bpf: allow precision tracking for programs with subprogs")
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20230918210110.2241458-1-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2023-09-20 03:26:25 -07:00
..
preload bpf: make preloaded map iterators to display map elements count 2023-07-06 12:42:25 -07:00
arraymap.c
bloom_filter.c bpf: Centralize permissions checks for all BPF map types 2023-06-19 14:04:04 +02:00
bpf_cgrp_storage.c bpf: Teach verifier that certain helpers accept NULL pointer. 2023-04-04 16:57:16 -07:00
bpf_inode_storage.c Networking changes for 6.4. 2023-04-26 16:07:23 -07:00
bpf_iter.c
bpf_local_storage.c bpf: bpf_sk_storage: Fix the missing uncharge in sk_omem_alloc 2023-09-06 11:08:14 +02:00
bpf_lru_list.c bpf: Address KCSAN report on bpf_lru_list 2023-05-12 12:01:03 -07:00
bpf_lru_list.h bpf: lru: Remove unused declaration bpf_lru_promote() 2023-08-08 17:21:42 -07:00
bpf_lsm.c
bpf_struct_ops.c bpf: Support default .validate() and .update() behavior for struct_ops links 2023-08-14 22:23:39 -07:00
bpf_struct_ops_types.h
bpf_task_storage.c bpf: Teach verifier that certain helpers accept NULL pointer. 2023-04-04 16:57:16 -07:00
btf.c bpf: Fix a erroneous check after snprintf() 2023-09-12 13:15:46 -07:00
cgroup.c bpf, cgroup: fix multiple kernel-doc warnings 2023-09-12 13:19:07 -07:00
cgroup_iter.c
core.c bpf: make bpf_prog_pack allocator portable 2023-09-06 06:26:05 -07:00
cpumap.c bpf, cpumask: Clean up bpf_cpu_map_entry directly in cpu_map_free 2023-08-21 15:21:16 -07:00
cpumask.c bpf: Convert bpf_cpumask to bpf_mem_cache_free_rcu. 2023-07-12 23:45:23 +02:00
devmap.c bpf, devmap: Remove unused dtab field from bpf_dtab_netdev 2023-07-31 18:26:08 -07:00
disasm.c bpf: change bpf_alu_sign_string and bpf_movsx_string to static 2023-08-04 16:15:50 -07:00
disasm.h
dispatcher.c
hashtab.c bpf: populate the per-cpu insertions/deletions counters for hashmaps 2023-07-06 12:42:25 -07:00
helpers.c bpf: Allow bpf_spin_{lock,unlock} in sleepable progs 2023-08-25 09:23:17 -07:00
inode.c bpf: convert to ctime accessor functions 2023-07-24 10:30:07 +02:00
Kconfig bpf: Add fd-based tcx multi-prog infra with link support 2023-07-19 10:07:27 -07:00
link_iter.c
local_storage.c cgroup changes for v6.4-rc1 2023-04-29 10:05:22 -07:00
log.c bpf: drop unnecessary user-triggerable WARN_ONCE in verifierl log 2023-05-16 22:34:50 -07:00
lpm_trie.c bpf: Centralize permissions checks for all BPF map types 2023-06-19 14:04:04 +02:00
Makefile bpf: Add fd-based tcx multi-prog infra with link support 2023-07-19 10:07:27 -07:00
map_in_map.c bpf: Fix elem_size not being set for inner maps 2023-06-02 16:22:12 -07:00
map_in_map.h
map_iter.c bpf: allow any program to use the bpf_map_sum_elem_count kfunc 2023-07-19 09:48:53 -07:00
memalloc.c bpf: Skip unit_size checking for global per-cpu allocator 2023-09-15 10:22:24 -07:00
mmap_unlock_work.h
mprog.c bpf: Fix mprog detachment for empty mprog entry 2023-08-04 09:35:39 -07:00
net_namespace.c
offload.c bpf: Avoid dummy bpf_offload_netdev in __bpf_prog_dev_bound_init 2023-09-11 22:06:06 -07:00
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-09-11 19:04:49 -07:00
reuseport_array.c bpf: Centralize permissions checks for all BPF map types 2023-06-19 14:04:04 +02:00
ringbuf.c bpf: Remove unnecessary ring buffer size check 2023-07-05 14:09:45 +02:00
stackmap.c bpf: Centralize permissions checks for all BPF map types 2023-06-19 14:04:04 +02:00
syscall.c bpf: Assign bpf_tramp_run_ctx::saved_run_ctx before recursion check. 2023-09-06 10:44:28 +02:00
sysfs_btf.c
task_iter.c
tcx.c tcx: Fix splat during dev unregister 2023-07-31 14:44:02 -07:00
tnum.c
trampoline.c bpf: Assign bpf_tramp_run_ctx::saved_run_ctx before recursion check. 2023-09-06 10:44:28 +02:00
verifier.c bpf: unconditionally reset backtrack_state masks on global func exit 2023-09-20 03:26:25 -07:00