diff options
author | Alexei Starovoitov <ast@kernel.org> | 2020-03-10 10:00:42 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2020-03-10 10:00:47 -0700 |
commit | f7861a55b1ce35d0cacfd1f0435f46533dbc9b67 (patch) | |
tree | 524f44a063aa249f4b93668b0149564311175cc7 /tools/perf/scripts/python/stackcollapse.py | |
parent | 1d8006abaab4cb90f81add86e8d1bf9411add05a (diff) | |
parent | 6ffe559a77d1c963a3567f7a39a5419bdcdc4f1c (diff) |
Merge branch 'fix-BTF-enum'
Yoshiki Komachi says:
====================
btf_enum_check_member() checked if the size of "enum" as a struct
member exceeded struct_size or not. Then, the function compared it
with the size of "int". Although the size of "enum" is 4-byte by
default (i.e., equivalent to "int"), the packing feature enables
us to reduce it, as illustrated by the following example:
struct A {
char m;
enum { E0, E1 } __attribute__((packed)) n;
};
With such a setup above, the bpf loader gave an error attempting
to load it:
------------------------------------------------------------------
...
[3] ENUM (anon) size=1 vlen=2
E0 val=0
E1 val=1
[4] STRUCT A size=2 vlen=2
m type_id=2 bits_offset=0
n type_id=3 bits_offset=8
[4] STRUCT A size=2 vlen=2
n type_id=3 bits_offset=8 Member exceeds struct_size
libbpf: Error loading .BTF into kernel: -22.
------------------------------------------------------------------
The related issue was previously fixed by the commit 9eea98497951 ("bpf:
fix BTF verification of enums"). On the other hand, this series fixes
this issue as well, and adds a selftest program for it.
Changes in v2:
- change an example in commit message based on Andrii's review
- add a selftest program for packed "enum" type members in struct/union
====================
Acked-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/stackcollapse.py')
0 files changed, 0 insertions, 0 deletions