Skip to content

Commit 7d75b83

Browse files
D-WytheKernel Patches Daemon
authored andcommitted
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 <[email protected]>
1 parent 5d00461 commit 7d75b83

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

kernel/bpf/bpf_struct_ops.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,7 @@ bool bpf_struct_ops_get(const void *kdata)
11621162
map = __bpf_map_inc_not_zero(&st_map->map, false);
11631163
return !IS_ERR(map);
11641164
}
1165+
EXPORT_SYMBOL_GPL(bpf_struct_ops_get);
11651166

11661167
void bpf_struct_ops_put(const void *kdata)
11671168
{
@@ -1173,6 +1174,7 @@ void bpf_struct_ops_put(const void *kdata)
11731174

11741175
bpf_map_put(&st_map->map);
11751176
}
1177+
EXPORT_SYMBOL_GPL(bpf_struct_ops_put);
11761178

11771179
u32 bpf_struct_ops_id(const void *kdata)
11781180
{

kernel/bpf/syscall.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1219,6 +1219,7 @@ int bpf_obj_name_cpy(char *dst, const char *src, unsigned int size)
12191219

12201220
return src - orig_src;
12211221
}
1222+
EXPORT_SYMBOL_GPL(bpf_obj_name_cpy);
12221223

12231224
int map_check_no_btf(const struct bpf_map *map,
12241225
const struct btf *btf,

0 commit comments

Comments
 (0)