All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Joan Bruguera Micó" <joanbrugueram@gmail.com>
To: jpoimboe@kernel.org
Cc: i.pear@outlook.com, acme@kernel.org, alan.maguire@oracle.com,
	alexandref75@gmail.com, bpf@vger.kernel.org, dxu@dxuuu.xyz,
	jforbes@redhat.com, linux-kernel@vger.kernel.org,
	olsajiri@gmail.com, peterz@infradead.org, ptalbert@redhat.com,
	yhs@fb.com
Subject: Re: [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes
Date: Thu, 13 Apr 2023 02:21:49 +0000	[thread overview]
Message-ID: <20230413022149.94781-1-joanbrugueram@gmail.com> (raw)
In-Reply-To: <20230412163016.5p7wve3meeahdecp@treble>

I have done some tests with Arch Linux which is also affected by this issue:

Base scenario: Running Arch Linux updated as of 2023-04-13.
               Building the linux-mainline 6.3rc6-1 from AUR
               (https://aur.archlinux.org/packages/linux-mainline)
               with CONFIG_X86_KERNEL_IBT changed to 'y'
Result:        Build fails with the "btf__dedup failed!" error

Test 1: Update dwarves (=pahole package on Arch Linux) from the current version
        (1:1.24+r29+g02d67c5-1) to the staging version (1:1.25-1).
Result: The build works correctly.

        However, the notes section is still not parsed correctly, as confirmed
        by `readelf -n` or adding a printf near the code on `cus__merging_cu`
        (on `dwarf_loader.c`) pointed to by Tianyi.

        A bisect shows the commit that fixes the build is
        a9498899109d3be14f17abbc322a8f55a1067bee
        "dwarf_loader: Fix for BTF id drift caused by adding unspecified types"
        I don't know why though.

Test 2: Applying Josh's patch to force-align the ELF notes section to 4 bytes
        (clarification: using the base pahole version again here)
Result: The build works correctly.
        I can read the notes correctly using `readelf -n` as well,
        and they are aligned to 4 bytes instead of 8.

Test 3: Similar to Josh's patch, but instead of force-aligning the sections,
        I added `.note.gnu.property` to the `/DISCARD/` list in the line above.
Result: The build works correctly.
        I can read the notes correctly using `readelf -n` as well
        (of course, the GNU notes which made the alignment be 8 bytes are gone;
         I don't know if this has any negative effect).

So, in summary, either upgrading dwarves/pahole from 1.24 to (not yet fully
released?) 1.25, or applying Josh's patch fixes the issue for me.
Despite the new dwarves/pahole version fixing the build, Josh's patch or
something else to fix the notes alignment is needed.

  reply	other threads:[~2023-04-13  2:22 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-22 17:48 Kernel build fail with 'btf_encoder__encode: btf__dedup failed!' Daniel Xu
2023-01-22 21:25 ` Daniel Xu
2023-01-23  8:06 ` Jiri Olsa
2023-01-24  6:13   ` Daniel Xu
2023-01-27 22:28     ` Alexandre Peixoto Ferreira
2023-01-28  0:00       ` Jiri Olsa
2023-01-28  0:21         ` Daniel Xu
2023-01-28  0:23           ` Daniel Xu
2023-01-28 19:23         ` Alexandre Peixoto Ferreira
2023-01-31 15:18           ` Jiri Olsa
2023-02-09  0:21             ` Vicki Pfau
2023-02-09  4:15             ` Alexandre Peixoto Ferreira
2023-02-09 13:07               ` Alan Maguire
2023-02-10 14:02                 ` Alexandre Peixoto Ferreira
2023-02-10 14:34                   ` Jiri Olsa
2023-02-10 15:37                     ` Alexandre Ferreira
2023-02-14  6:33                       ` Tianyi Liu
2023-04-11 17:00                         ` [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes Josh Poimboeuf
2023-04-12  7:10                           ` Tianyi Liu
2023-04-12 16:30                             ` Josh Poimboeuf
2023-04-13  2:21                               ` Joan Bruguera Micó [this message]
2023-04-13  9:23                                 ` Tianyi Liu
2023-04-13 18:59                                   ` [PATCH] vmlinux.lds.h: Discard .note.gnu.property section Josh Poimboeuf
2023-04-16 19:02                                     ` Joan Bruguera Micó
2023-04-18 21:47                                       ` Josh Poimboeuf
2023-04-18 21:49                                         ` [PATCH v2] " Josh Poimboeuf
2023-04-13  4:54                               ` [PATCH] vmlinux.lds.h: Force-align ELF notes section to four bytes Tianyi Liu
2023-04-16 18:52                                 ` Joan Bruguera Micó
2023-04-27  5:14                                   ` Joan Bruguera Micó
2023-05-18 11:00 ` [tip: objtool/urgent] vmlinux.lds.h: Discard .note.gnu.property section tip-bot2 for Josh Poimboeuf

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=20230413022149.94781-1-joanbrugueram@gmail.com \
    --to=joanbrugueram@gmail.com \
    --cc=acme@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=alexandref75@gmail.com \
    --cc=bpf@vger.kernel.org \
    --cc=dxu@dxuuu.xyz \
    --cc=i.pear@outlook.com \
    --cc=jforbes@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olsajiri@gmail.com \
    --cc=peterz@infradead.org \
    --cc=ptalbert@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.