Commit-ID:  2e9490ba5830a60a18a359192e938b2ad1710120
Gitweb:     https://git.kernel.org/tip/2e9490ba5830a60a18a359192e938b2ad1710120
Author:     Josh Poimboeuf <jpoim...@redhat.com>
AuthorDate: Mon, 29 Jan 2018 22:00:41 -0600
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Tue, 30 Jan 2018 07:55:05 +0100

objtool: Warn on stripped section symbol

With the following fix:

  2a0098d70640 ("objtool: Fix seg fault with gold linker")

... a seg fault was avoided, but the original seg fault condition in
objtool wasn't fixed.  Replace the seg fault with an error message.

Suggested-by: Ingo Molnar <mi...@kernel.org>
Signed-off-by: Josh Poimboeuf <jpoim...@redhat.com>
Cc: Andy Lutomirski <l...@kernel.org>
Cc: Borislav Petkov <b...@alien8.de>
Cc: Dave Hansen <dave.han...@linux.intel.com>
Cc: David Woodhouse <dw...@infradead.org>
Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
Cc: Guenter Roeck <li...@roeck-us.net>
Cc: H. Peter Anvin <h...@zytor.com>
Cc: Juergen Gross <jgr...@suse.com>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Link: 
http://lkml.kernel.org/r/dc4585a70d6b975c99fc51d1957ccdde7bd52f3a.1517284349.git.jpoim...@redhat.com
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 tools/objtool/orc_gen.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/objtool/orc_gen.c b/tools/objtool/orc_gen.c
index e5ca314..e2c3b4b 100644
--- a/tools/objtool/orc_gen.c
+++ b/tools/objtool/orc_gen.c
@@ -98,6 +98,11 @@ static int create_orc_entry(struct section *u_sec, struct 
section *ip_relasec,
        struct orc_entry *orc;
        struct rela *rela;
 
+       if (!insn_sec->sym) {
+               WARN("missing symbol for section %s", insn_sec->name);
+               return -1;
+       }
+
        /* populate ORC data */
        orc = (struct orc_entry *)u_sec->data->d_buf + idx;
        memcpy(orc, o, sizeof(*orc));

Reply via email to