lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 11 Jul 2019 12:26:21 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     Peter Zijlstra <peterz@...radead.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        clang-built-linux <clang-built-linux@...glegroups.com>,
        Nick Desaulniers <ndesaulniers@...gle.com>
Subject: Re: objtool crashes on clang output (drivers/hwmon/pmbus/adm1275.o)

On Thu, Jul 11, 2019 at 02:40:06PM +0200, Arnd Bergmann wrote:
> During randconfig testing with clang-9, I came across an object file
> that makes objtool segfault, see attachment. Let me know if you need
> more information to
> debug this.
> 
> I also get a ton of objtool warnings building random configurations, but Nick
> mentioned that there is still a bug related to asm-goto in the build I'm using
> that may be the root cause. Once I have a fixed clang-9 build, I can have a look
> at those as well.

Seg fault fix:

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index 27818a93f0b1..ad18f8ef905a 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -902,7 +902,7 @@ static int add_switch_table(struct objtool_file *file, struct instruction *insn,
 			    struct rela *table, struct rela *next_table)
 {
 	struct rela *rela = table;
-	struct instruction *alt_insn;
+	struct instruction *alt_insn, *prev_insn;
 	struct alternative *alt;
 	struct symbol *pfunc = insn->func->pfunc;
 	unsigned int prev_offset = 0;
@@ -924,6 +924,20 @@ static int add_switch_table(struct objtool_file *file, struct instruction *insn,
 		if (!alt_insn)
 			break;
 
+		if (!alt_insn->func) {
+			/*
+			 * Clang 9 has a quirk where a switch table may have
+			 * unused entries in the middle of the table which
+			 * point to just past the end of the function.  They're
+			 * still part of the table but can be ignored.
+			 */
+			prev_insn = list_prev_entry(alt_insn, list);
+			if (prev_insn->func && prev_insn->func->pfunc == pfunc)
+				goto skip;
+
+			break;
+		}
+
 		/* Make sure the jmp dest is in the function or subfunction: */
 		if (alt_insn->func->pfunc != pfunc)
 			break;
@@ -936,6 +950,7 @@ static int add_switch_table(struct objtool_file *file, struct instruction *insn,
 
 		alt->insn = alt_insn;
 		list_add_tail(&alt->list, &insn->alts);
+skip:
 		prev_offset = rela->offset;
 	}
 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ