From: Matt Smith alastorze@fb.com
mainline inclusion from mainline-5.16-rc1 commit 08a6f22ef6f843d0ea7252087787b5ab04610bec 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/?i...
-------------------------------------------------
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: Matt Smith alastorze@fb.com Signed-off-by: Andrii Nakryiko andrii@kernel.org Link: https://lore.kernel.org/bpf/20210901194439.3853238-2-alastorze@fb.com (cherry picked from commit 08a6f22ef6f843d0ea7252087787b5ab04610bec) Signed-off-by: Wang Yufen wangyufen@huawei.com --- tools/lib/bpf/libbpf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h index f76d640d0fa0..12b9d15911dc 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -790,7 +790,7 @@ struct bpf_object_skeleton { size_t sz; /* size of this struct, for forward/backward compatibility */
const char *name; - void *data; + const void *data; size_t data_sz;
struct bpf_object **obj;