dwarf_loader: Support DW_FORM_implicit_const in __attr_offset()

Noticed witth selftest/bpf/test_verifier_log failing on v5.11-rc5 with a
newer gcc.

However looks like we don't handle DW_FORM_implicit_const when counting
the byte offset (when handling DW_AT_data_member_location)... It was
used for some struct members in my vmlinux, so we got zero for byte
offset and that created another unique struct.

With this patch I no longer see any struct duplication, also
test_verifier_log is working for me, but I could not reproduce the error
before.

Reported-by: Paul Moore <paul@paul-moore.com>
Reported-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Andrii Nakryiko <andrii@kernel.org>
Cc: bpf <bpf@vger.kernel.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
Jiri Olsa 2021-01-31 22:36:41 +01:00 committed by Arnaldo Carvalho de Melo
parent b91b19840b
commit 3ff98a6396
1 changed files with 1 additions and 0 deletions

View File

@ -296,6 +296,7 @@ static Dwarf_Off __attr_offset(Dwarf_Attribute *attr)
Dwarf_Block block;
switch (dwarf_whatform(attr)) {
case DW_FORM_implicit_const:
case DW_FORM_data1:
case DW_FORM_data2:
case DW_FORM_data4: