All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Joe Lawrence" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Joe Lawrence <joe.lawrence@redhat.com>,
	Miroslav Benes <mbenes@suse.cz>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Andy Lavr <andy.lavr@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/core] objtool: Make .altinstructions section entry size consistent
Date: Wed, 06 Oct 2021 22:46:17 -0000	[thread overview]
Message-ID: <163356037786.25758.8614363087298524977.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210822225037.54620-2-joe.lawrence@redhat.com>

The following commit has been merged into the objtool/core branch of tip:

Commit-ID:     dc02368164bd0ec603e3f5b3dd8252744a667b8a
Gitweb:        https://git.kernel.org/tip/dc02368164bd0ec603e3f5b3dd8252744a667b8a
Author:        Joe Lawrence <joe.lawrence@redhat.com>
AuthorDate:    Sun, 22 Aug 2021 18:50:36 -04:00
Committer:     Josh Poimboeuf <jpoimboe@redhat.com>
CommitterDate: Tue, 05 Oct 2021 12:03:20 -07:00

objtool: Make .altinstructions section entry size consistent

Commit e31694e0a7a7 ("objtool: Don't make .altinstructions writable")
aligned objtool-created and kernel-created .altinstructions section
flags, but there remains a minor discrepency in their use of a section
entry size: objtool sets one while the kernel build does not.

While sh_entsize of sizeof(struct alt_instr) seems intuitive, this small
deviation can cause failures with external tooling (kpatch-build).

Fix this by creating new .altinstructions sections with sh_entsize of 0
and then later updating sec->sh_size as alternatives are added to the
section.  An added benefit is avoiding the data descriptor and buffer
created by elf_create_section(), but previously unused by
elf_add_alternative().

Fixes: 9bc0bb50727c ("objtool/x86: Rewrite retpoline thunk calls")
Signed-off-by: Joe Lawrence <joe.lawrence@redhat.com>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20210822225037.54620-2-joe.lawrence@redhat.com
Cc: Andy Lavr <andy.lavr@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: x86@kernel.org
Cc: linux-kernel@vger.kernel.org
---
 tools/objtool/arch/x86/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/objtool/arch/x86/decode.c b/tools/objtool/arch/x86/decode.c
index bc82105..0893436 100644
--- a/tools/objtool/arch/x86/decode.c
+++ b/tools/objtool/arch/x86/decode.c
@@ -684,7 +684,7 @@ static int elf_add_alternative(struct elf *elf,
 	sec = find_section_by_name(elf, ".altinstructions");
 	if (!sec) {
 		sec = elf_create_section(elf, ".altinstructions",
-					 SHF_ALLOC, size, 0);
+					 SHF_ALLOC, 0, 0);
 
 		if (!sec) {
 			WARN_ELF("elf_create_section");

  reply	other threads:[~2021-10-06 22:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-22 22:50 [PATCH v3 0/2] objtool: altinstructions fix and cleanup Joe Lawrence
2021-08-22 22:50 ` [PATCH v3 1/2] objtool: make .altinstructions section entry size consistent Joe Lawrence
2021-10-06 22:46   ` tip-bot2 for Joe Lawrence [this message]
2021-08-22 22:50 ` [PATCH v3 2/2] objtool: remove redundant len value from struct section Joe Lawrence
2021-10-06 22:46   ` [tip: objtool/core] objtool: Remove redundant 'len' field " tip-bot2 for Joe Lawrence
2021-09-03 11:16 ` [PATCH v3 0/2] objtool: altinstructions fix and cleanup Miroslav Benes
2021-09-04  4:46 ` 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=163356037786.25758.8614363087298524977.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=andy.lavr@gmail.com \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=peterz@infradead.org \
    --cc=x86@kernel.org \
    /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.