提交 fcb215b3 编写于 作者: M Matt Smith 提交者: Zheng Zengkai

libbpf: Change bpf_object_skeleton data field to const pointer

mainline inclusion
from mainline-5.16-rc1
commit 08a6f22e
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I5EUVD
CVE: NA

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=08a6f22ef6f843d0ea7252087787b5ab04610bec

-------------------------------------------------

This change was necessary to enforce the implied contract
that bpf_object_skeleton->data should not be mutated.  The data
will be cast to `void *` during assignment to handle the case
where a user is compiling with older libbpf headers to avoid
a compiler warning of `const void *` data being cast to `void *`
Signed-off-by: NMatt Smith <alastorze@fb.com>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20210901194439.3853238-2-alastorze@fb.com
(cherry picked from commit 08a6f22e)
Signed-off-by: NWang Yufen <wangyufen@huawei.com>
上级 8d30981a
...@@ -790,7 +790,7 @@ struct bpf_object_skeleton { ...@@ -790,7 +790,7 @@ struct bpf_object_skeleton {
size_t sz; /* size of this struct, for forward/backward compatibility */ size_t sz; /* size of this struct, for forward/backward compatibility */
const char *name; const char *name;
void *data; const void *data;
size_t data_sz; size_t data_sz;
struct bpf_object **obj; struct bpf_object **obj;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册