diff options
author | Andrii Nakryiko <andriin@fb.com> | 2020-07-14 01:24:09 +0200 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-07-14 02:07:43 +0200 |
commit | 0b20933d8cfe2bf6473e9b581b5d1ed9a2117ecc (patch) | |
tree | 79a7e9cabc285400476b921dbdaa4bba220fa46e /tools/lib | |
parent | libbpf: Support stripping modifiers for btf_dump (diff) | |
download | linux-0b20933d8cfe2bf6473e9b581b5d1ed9a2117ecc.tar.xz linux-0b20933d8cfe2bf6473e9b581b5d1ed9a2117ecc.zip |
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
Diffstat (limited to 'tools/lib')
-rw-r--r-- | tools/lib/bpf/btf.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/tools/lib/bpf/btf.h b/tools/lib/bpf/btf.h index 227d3f844801..491c7b41ffdc 100644 --- a/tools/lib/bpf/btf.h +++ b/tools/lib/bpf/btf.h @@ -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, |