mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-23 17:59:06 +08:00
tools/bpftool: Strip away modifiers from global variables
Reliably remove all the type modifiers from read-only (.rodata) global
variable definitions, including cases of inner field const modifiers and
arrays of const values.
Also modify one of selftests to ensure that const volatile struct doesn't
prevent user-space from modifying .rodata variable.
Fixes: 985ead416df3 ("bpftool: Add skeleton codegen command")
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20200713232409.3062144-3-andriin@fb.com
This commit is contained in:
committed by
Andrii Nakryiko
parent
de60a31eba
commit
852b4c8e73
@@ -147,7 +147,7 @@ struct btf_dump_emit_type_decl_opts {
|
||||
/* strip all the const/volatile/restrict mods */
|
||||
bool strip_mods;
|
||||
};
|
||||
#define btf_dump_emit_type_decl_opts__last_field indent_level
|
||||
#define btf_dump_emit_type_decl_opts__last_field strip_mods
|
||||
|
||||
LIBBPF_API int
|
||||
btf_dump__emit_type_decl(struct btf_dump *d, __u32 id,
|
||||
|
||||
Reference in New Issue
Block a user