From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Jiri Olsa <jolsa@kernel.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Mark Wielaard <mjw@redhat.com>, Nick Clifton <nickc@redhat.com>,
netdev@vger.kernel.org, bpf@vger.kernel.org,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>, Andrii Nakryiko <andriin@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>,
brouer@redhat.com
Subject: Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment
Date: Wed, 19 Aug 2020 19:02:53 +0200 [thread overview]
Message-ID: <20200819190253.2c795745@carbon> (raw)
In-Reply-To: <20200819092342.259004-1-jolsa@kernel.org>
On Wed, 19 Aug 2020 11:23:42 +0200 Jiri Olsa <jolsa@kernel.org> wrote:
> The data of compressed section should be aligned to 4
> (for 32bit) or 8 (for 64 bit) bytes.
>
> The binutils ld sets sh_addralign to 1, which makes libelf
> fail with misaligned section error during the update as
> reported by Jesper:
>
> FAILED elf_update(WRITE): invalid section alignment
>
> While waiting for ld fix, we can fix compressed sections
> sh_addralign value manually.
>
> Adding warning in -vv mode when the fix is triggered:
>
> $ ./tools/bpf/resolve_btfids/resolve_btfids -vv vmlinux
> ...
> section(36) .comment, size 44, link 0, flags 30, type=1
> section(37) .debug_aranges, size 45684, link 0, flags 800, type=1
> - fixing wrong alignment sh_addralign 16, expected 8
> section(38) .debug_info, size 129104957, link 0, flags 800, type=1
> - fixing wrong alignment sh_addralign 1, expected 8
> section(39) .debug_abbrev, size 1152583, link 0, flags 800, type=1
> - fixing wrong alignment sh_addralign 1, expected 8
> section(40) .debug_line, size 7374522, link 0, flags 800, type=1
> - fixing wrong alignment sh_addralign 1, expected 8
> section(41) .debug_frame, size 702463, link 0, flags 800, type=1
> section(42) .debug_str, size 1017571, link 0, flags 830, type=1
> - fixing wrong alignment sh_addralign 1, expected 8
> section(43) .debug_loc, size 3019453, link 0, flags 800, type=1
> - fixing wrong alignment sh_addralign 1, expected 8
> section(44) .debug_ranges, size 1744583, link 0, flags 800, type=1
> - fixing wrong alignment sh_addralign 16, expected 8
> section(45) .symtab, size 2955888, link 46, flags 0, type=2
> section(46) .strtab, size 2613072, link 0, flags 0, type=3
> ...
> update ok for vmlinux
I also works for me:
[...]
section(37) .debug_aranges, size 45684, link 0, flags 800, type=1
- fixing wrong alignment sh_addralign 16, expected 8
section(38) .debug_info, size 129098181, link 0, flags 800, type=1
- fixing wrong alignment sh_addralign 1, expected 8
section(39) .debug_abbrev, size 1152583, link 0, flags 800, type=1
- fixing wrong alignment sh_addralign 1, expected 8
section(40) .debug_line, size 7374522, link 0, flags 800, type=1
- fixing wrong alignment sh_addralign 1, expected 8
section(41) .debug_frame, size 702463, link 0, flags 800, type=1
section(42) .debug_str, size 1017606, link 0, flags 830, type=1
- fixing wrong alignment sh_addralign 1, expected 8
section(43) .debug_loc, size 3019453, link 0, flags 800, type=1
- fixing wrong alignment sh_addralign 1, expected 8
section(44) .debug_ranges, size 1744583, link 0, flags 800, type=1
- fixing wrong alignment sh_addralign 16, expected 8
section(45) .symtab, size 2955888, link 46, flags 0, type=2
section(46) .strtab, size 2613072, link 0, flags 0, type=3
section(47) .shstrtab, size 525, link 0, flags 0, type=3
[...]
update ok for vmlinux.err.bak
>
> Another workaround is to disable compressed debug info data
> CONFIG_DEBUG_INFO_COMPRESSED kernel option.
>
> Fixes: fbbb68de80a4 ("bpf: Add resolve_btfids tool to resolve BTF IDs in ELF object")
> Cc: Mark Wielaard <mjw@redhat.com>
> Cc: Nick Clifton <nickc@redhat.com>
> Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
Thanks for fixing this!
Acked-by: Jesper Dangaard Brouer <brouer@redhat.com>
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
next prev parent reply other threads:[~2020-08-19 17:03 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-19 9:23 [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment Jiri Olsa
2020-08-19 15:31 ` Yonghong Song
2020-08-19 17:36 ` Jiri Olsa
2020-08-19 18:16 ` Nick Desaulniers
2020-08-19 21:30 ` Yonghong Song
2020-08-20 2:27 ` Fāng-ruì Sòng
2020-08-20 3:23 ` Yonghong Song
2020-08-20 10:18 ` Jiri Olsa
2020-08-20 10:18 ` Mark Wielaard
2020-08-20 15:51 ` Yonghong Song
2020-08-20 17:36 ` Mark Wielaard
2020-08-20 17:54 ` Yonghong Song
2020-08-20 21:24 ` Alexei Starovoitov
2020-08-19 17:02 ` Jesper Dangaard Brouer [this message]
2020-08-19 21:32 ` Yonghong Song
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200819190253.2c795745@carbon \
--to=brouer@redhat.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kafai@fb.com \
--cc=kpsingh@chromium.org \
--cc=mjw@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nickc@redhat.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).