All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Michael Forney" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Michael Forney <mforney@mforney.org>,
	Miroslav Benes <mbenes@suse.cz>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: objtool/urgent] objtool: Check for gelf_update_rel[a] failures
Date: Wed, 13 Oct 2021 21:42:42 -0000	[thread overview]
Message-ID: <163416136222.25758.15837995452727110892.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20210509000103.11008-1-mforney@mforney.org>

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

Commit-ID:     b46179d6bb3182c020f2bf9bb4df6ba5463b0495
Gitweb:        https://git.kernel.org/tip/b46179d6bb3182c020f2bf9bb4df6ba5463b0495
Author:        Michael Forney <mforney@mforney.org>
AuthorDate:    Sat, 08 May 2021 17:01:02 -07:00
Committer:     Josh Poimboeuf <jpoimboe@redhat.com>
CommitterDate: Wed, 06 Oct 2021 20:11:53 -07:00

objtool: Check for gelf_update_rel[a] failures

Otherwise, if these fail we end up with garbage data in the
.rela.orc_unwind_ip section, leading to errors like

  ld: fs/squashfs/namei.o: bad reloc symbol index (0x7f16 >= 0x12) for offset 0x7f16d5c82cc8 in section `.orc_unwind_ip'

Signed-off-by: Michael Forney <mforney@mforney.org>
Reviewed-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Link: https://lore.kernel.org/r/20210509000103.11008-1-mforney@mforney.org
---
 tools/objtool/elf.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
index b18f005..d1d4491 100644
--- a/tools/objtool/elf.c
+++ b/tools/objtool/elf.c
@@ -1001,7 +1001,10 @@ static int elf_rebuild_rel_reloc_section(struct section *sec, int nr)
 	list_for_each_entry(reloc, &sec->reloc_list, list) {
 		reloc->rel.r_offset = reloc->offset;
 		reloc->rel.r_info = GELF_R_INFO(reloc->sym->idx, reloc->type);
-		gelf_update_rel(sec->data, idx, &reloc->rel);
+		if (!gelf_update_rel(sec->data, idx, &reloc->rel)) {
+			WARN_ELF("gelf_update_rel");
+			return -1;
+		}
 		idx++;
 	}
 
@@ -1033,7 +1036,10 @@ static int elf_rebuild_rela_reloc_section(struct section *sec, int nr)
 		reloc->rela.r_offset = reloc->offset;
 		reloc->rela.r_addend = reloc->addend;
 		reloc->rela.r_info = GELF_R_INFO(reloc->sym->idx, reloc->type);
-		gelf_update_rela(sec->data, idx, &reloc->rela);
+		if (!gelf_update_rela(sec->data, idx, &reloc->rela)) {
+			WARN_ELF("gelf_update_rela");
+			return -1;
+		}
 		idx++;
 	}
 

      parent reply	other threads:[~2021-10-13 21:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-09  0:01 [PATCH 1/2] objtool: Check for gelf_update_rel[a] failures Michael Forney
2021-05-09  0:01 ` [PATCH 2/2] objtool: Update section header before relocations Michael Forney
2021-06-29  7:55   ` Miroslav Benes
2021-10-13 21:42   ` [tip: objtool/urgent] " tip-bot2 for Michael Forney
2021-06-28  7:52 ` [PATCH 1/2] objtool: Check for gelf_update_rel[a] failures Michael Forney
2021-06-28  8:24   ` Peter Zijlstra
2021-06-29 17:12     ` Josh Poimboeuf
2021-08-28 19:04       ` Michael Forney
2021-10-06 16:58         ` Michael Forney
2021-10-07  3:16           ` Josh Poimboeuf
2021-06-29  7:54 ` Miroslav Benes
2021-10-13 21:42 ` tip-bot2 for Michael Forney [this message]

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=163416136222.25758.15837995452727110892.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --cc=mforney@mforney.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.