Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Export necessary symbols for modules with struct_ops

Exports three necessary symbols for implementing struct_ops with
tristate subsystem.

To hold or release refcnt of struct_ops refcnt by inline funcs
bpf_try_module_get and bpf_module_put which use bpf_struct_ops_get(put)
conditionally.

And to copy obj name from one to the other with effective checks by
bpf_obj_name_cpy.

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Link: https://patch.msgid.link/20251107035632.115950-2-alibuda@linux.alibaba.com

authored by

D. Wythe and committed by
Martin KaFai Lau
07c428ec abd0c0f6

+3
+2
kernel/bpf/bpf_struct_ops.c
··· 1162 1162 map = __bpf_map_inc_not_zero(&st_map->map, false); 1163 1163 return !IS_ERR(map); 1164 1164 } 1165 + EXPORT_SYMBOL_GPL(bpf_struct_ops_get); 1165 1166 1166 1167 void bpf_struct_ops_put(const void *kdata) 1167 1168 { ··· 1174 1173 1175 1174 bpf_map_put(&st_map->map); 1176 1175 } 1176 + EXPORT_SYMBOL_GPL(bpf_struct_ops_put); 1177 1177 1178 1178 u32 bpf_struct_ops_id(const void *kdata) 1179 1179 {
+1
kernel/bpf/syscall.c
··· 1234 1234 1235 1235 return src - orig_src; 1236 1236 } 1237 + EXPORT_SYMBOL_GPL(bpf_obj_name_cpy); 1237 1238 1238 1239 int map_check_no_btf(const struct bpf_map *map, 1239 1240 const struct btf *btf,