mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 13:25:20 +02:00
bpf: Add namespace to BPF internal symbols
[ Upstream commit f88886de0927a2adf4c1b4c5c1f1d31d2023ef74 ]
Add namespace to BPF internal symbols used by light skeleton
to prevent abuse and document with the code their allowed usage.
Fixes: b1d18a7574
("bpf: Extend sys_bpf commands for bpf_syscall programs.")
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Acked-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Link: https://lore.kernel.org/bpf/20250425014542.62385-1-alexei.starovoitov@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3decda1a3c
commit
955f9ede52
|
@ -382,6 +382,14 @@ In case of new BPF instructions, once the changes have been accepted
|
|||
into the Linux kernel, please implement support into LLVM's BPF back
|
||||
end. See LLVM_ section below for further information.
|
||||
|
||||
Q: What "BPF_INTERNAL" symbol namespace is for?
|
||||
-----------------------------------------------
|
||||
A: Symbols exported as BPF_INTERNAL can only be used by BPF infrastructure
|
||||
like preload kernel modules with light skeleton. Most symbols outside
|
||||
of BPF_INTERNAL are not expected to be used by code outside of BPF either.
|
||||
Symbols may lack the designation because they predate the namespaces,
|
||||
or due to an oversight.
|
||||
|
||||
Stable submission
|
||||
=================
|
||||
|
||||
|
|
|
@ -89,4 +89,5 @@ static void __exit fini(void)
|
|||
}
|
||||
late_initcall(load);
|
||||
module_exit(fini);
|
||||
MODULE_IMPORT_NS("BPF_INTERNAL");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
@ -1457,7 +1457,7 @@ struct bpf_map *bpf_map_get(u32 ufd)
|
|||
|
||||
return map;
|
||||
}
|
||||
EXPORT_SYMBOL(bpf_map_get);
|
||||
EXPORT_SYMBOL_NS(bpf_map_get, BPF_INTERNAL);
|
||||
|
||||
struct bpf_map *bpf_map_get_with_uref(u32 ufd)
|
||||
{
|
||||
|
@ -3223,7 +3223,7 @@ struct bpf_link *bpf_link_get_from_fd(u32 ufd)
|
|||
bpf_link_inc(link);
|
||||
return link;
|
||||
}
|
||||
EXPORT_SYMBOL(bpf_link_get_from_fd);
|
||||
EXPORT_SYMBOL_NS(bpf_link_get_from_fd, BPF_INTERNAL);
|
||||
|
||||
static void bpf_tracing_link_release(struct bpf_link *link)
|
||||
{
|
||||
|
@ -5853,7 +5853,7 @@ int kern_sys_bpf(int cmd, union bpf_attr *attr, unsigned int size)
|
|||
return ____bpf_sys_bpf(cmd, attr, size);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(kern_sys_bpf);
|
||||
EXPORT_SYMBOL_NS(kern_sys_bpf, BPF_INTERNAL);
|
||||
|
||||
static const struct bpf_func_proto bpf_sys_bpf_proto = {
|
||||
.func = bpf_sys_bpf,
|
||||
|
|
Loading…
Reference in New Issue
Block a user