Centos-kernel-stream-9/kernel/bpf
Yauheni Kaliuta 39845718d1 bpf: Make BTF type match stricter for release arguments
Bugzilla: https://bugzilla.redhat.com/2120968

commit 2ab3b3808eb17f729edfd69e061667ca0a427195
Author: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Date:   Mon Apr 25 03:18:57 2022 +0530

    bpf: Make BTF type match stricter for release arguments
    
    The current of behavior of btf_struct_ids_match for release arguments is
    that when type match fails, it retries with first member type again
    (recursively). Since the offset is already 0, this is akin to just
    casting the pointer in normal C, since if type matches it was just
    embedded inside parent sturct as an object. However, we want to reject
    cases for release function type matching, be it kfunc or BPF helpers.
    
    An example is the following:
    
    struct foo {
    	struct bar b;
    };
    
    struct foo *v = acq_foo();
    rel_bar(&v->b); // btf_struct_ids_match fails btf_types_are_same, then
    		// retries with first member type and succeeds, while
    		// it should fail.
    
    Hence, don't walk the struct and only rely on btf_types_are_same for
    strict mode. All users of strict mode must be dealing with zero offset
    anyway, since otherwise they would want the struct to be walked.
    
    Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
    Signed-off-by: Alexei Starovoitov <ast@kernel.org>
    Link: https://lore.kernel.org/bpf/20220424214901.2743946-10-memxor@gmail.com

Signed-off-by: Yauheni Kaliuta <ykaliuta@redhat.com>
2022-11-30 12:46:59 +02:00
..
preload bpf: Remove redundant slash 2022-10-25 14:57:58 +02:00
Kconfig bpf: Add "live packet" mode for XDP in BPF_PROG_RUN 2022-10-25 14:57:58 +02:00
Makefile bpf: Prepare relo_core.c for kernel duty. 2022-08-24 12:53:42 +02:00
arraymap.c bpf: Wire up freeing of referenced kptr 2022-11-30 12:46:59 +02:00
bloom_filter.c bpf: Add missing map_get_next_key method to bloom filter map. 2022-06-03 17:23:52 +03:00
bpf_inode_storage.c bpf: Enable non-atomic allocations in local storage 2022-10-25 14:58:06 +02:00
bpf_iter.c bpf: Remove redundant assignment to meta.seq in __task_seq_show() 2022-11-28 16:48:59 +02:00
bpf_local_storage.c bpf: Enable non-atomic allocations in local storage 2022-10-25 14:58:06 +02:00
bpf_lru_list.c bpf_lru_list: Read double-checked variable once without lock 2021-02-10 15:54:26 -08:00
bpf_lru_list.h printk: stop including cache.h from printk.h 2022-08-25 10:45:13 -06:00
bpf_lsm.c bpf-lsm: Make bpf_lsm_kernel_read_file() as sleepable 2022-10-25 14:58:02 +02:00
bpf_struct_ops.c bpf: Remove unnecessary type castings 2022-11-28 16:52:09 +02:00
bpf_struct_ops_types.h bpf: Add dummy BPF STRUCT_OPS for test purpose 2022-06-03 17:23:49 +03:00
bpf_task_storage.c bpf: Enable non-atomic allocations in local storage 2022-10-25 14:58:06 +02:00
btf.c bpf: Make BTF type match stricter for release arguments 2022-11-30 12:46:59 +02:00
cgroup.c bpf: Use bpf_prog_run_array_cg_flags everywhere 2022-11-28 16:52:11 +02:00
core.c bpf, x86: fix freeing of not-finalized bpf_prog_pack 2022-10-25 14:58:10 +02:00
cpumap.c bpf: generalise tail call map compatibility check 2022-10-25 14:57:42 +02:00
devmap.c bpf: generalise tail call map compatibility check 2022-10-25 14:57:42 +02:00
disasm.c bpf: Relicense disassembler as GPL-2.0-only OR BSD-2-Clause 2022-04-29 18:17:12 +02:00
disasm.h bpf: Relicense disassembler as GPL-2.0-only OR BSD-2-Clause 2022-04-29 18:17:12 +02:00
dispatcher.c
hashtab.c bpf: Wire up freeing of referenced kptr 2022-11-30 12:46:59 +02:00
helpers.c bpf: Allow storing referenced kptr in map 2022-11-28 16:52:11 +02:00
inode.c bpf: Convert bpf_preload.ko to use light skeleton. 2022-10-25 14:57:49 +02:00
local_storage.c bpf: Cleanup comments 2022-10-25 14:57:51 +02:00
lpm_trie.c bpf: Fix typo in a comment in bpf lpm_trie. 2022-08-24 12:53:51 +02:00
map_in_map.c bpf: Allow storing unreferenced kptr in map 2022-11-28 16:52:11 +02:00
map_in_map.h
map_iter.c bpf: Introduce MEM_RDONLY flag 2022-08-24 12:53:50 +02:00
mmap_unlock_work.h bpf: Introduce helper bpf_find_vma 2022-08-24 12:53:34 +02:00
net_namespace.c net: Add includes masked by netdevice.h including uapi/bpf.h 2022-08-24 12:53:55 +02:00
offload.c
percpu_freelist.c bpf: Use raw_spin_trylock() for pcpu_freelist_push/pop in NMI 2020-10-06 00:04:11 +02:00
percpu_freelist.h bpf: Use raw_spin_trylock() for pcpu_freelist_push/pop in NMI 2020-10-06 00:04:11 +02:00
prog_iter.c
queue_stack_maps.c bpf: Eliminate rlimit-based memory accounting for queue_stack_maps maps 2020-12-02 18:32:46 -08:00
reuseport_array.c bpf: Cleanup comments 2022-10-25 14:57:51 +02:00
ringbuf.c bpf: Tag argument to be released in bpf_func_proto 2022-11-28 16:52:11 +02:00
stackmap.c bpf: Fix excessive memory allocation in stack_map_alloc() 2022-11-28 16:48:58 +02:00
syscall.c bpf: Wire up freeing of referenced kptr 2022-11-30 12:46:59 +02:00
sysfs_btf.c bpf: Load and verify kernel module BTFs 2020-11-10 15:25:53 -08:00
task_iter.c bpf: Remove redundant assignment to meta.seq in __task_seq_show() 2022-11-28 16:48:59 +02:00
tnum.c bpf, tnums: Provably sound, faster, and more precise algorithm for tnum_mul 2021-06-01 13:34:15 +02:00
trampoline.c Merge: BPF and XDP rebase to v5.18 2022-11-21 05:30:47 -05:00
verifier.c bpf: Make BTF type match stricter for release arguments 2022-11-30 12:46:59 +02:00