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-next>] [day] [month] [year] [list]
Date:   Thu, 8 Mar 2018 01:11:26 -0500 (EST)
From:   Mikulas Patocka <mpatocka@...hat.com>
To:     Peter Zijlstra <peterz@...radead.org>
cc:     David Woodhouse <dwmw2@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        Andy Lutomirski <luto@...nel.org>,
        Arjan van de Ven <arjan@...ux.intel.com>,
        Borislav Petkov <bp@...en8.de>,
        Dan Williams <dan.j.williams@...el.com>,
        Dave Hansen <dave.hansen@...ux.intel.com>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org
Subject: [PATCH] fix compilation of 64-bit kernel with 32-bit compiler

The patch b5bc2231b8ad4387c9641f235ca0ad8cd300b6df ("objtool: Add 
retpoline validation") broke compiling 64-bit kernel with 32-bit compiler.

This patch fixes the following error and a large number of "can't find
rela for retpoline_safe" errors that occur when using x32 or i386 gcc.

You shouldn't use the type 'unsigned long' in objtool at all - because its
size depends on the compiler and not on the kernel you are compiling.

In file included from check.c:26:0:
check.c: In function 'read_retpoline_hints':
warn.h:57:3: error: format '%ld' expects argument of type 'long int', but argument 5 has type 'unsigned int' [-Werror=format=]
   "%s: warning: objtool: " format "\n", \
   ^
check.c:1135:3: note: in expansion of macro 'WARN'
   WARN("retpoline_safe size mismatch: %d %ld", sec->len, sizeof(unsigned long));
   ^~~~
check.c:1135:44: note: format string is defined here
   WARN("retpoline_safe size mismatch: %d %ld", sec->len, sizeof(unsigned long));
                                          ~~^
                                          %d

Signed-off-by: Mikulas Patocka <mpatocka@...hat.com>
Fixes: b5bc2231b8ad ("objtool: Add retpoline validation")

---
 tools/objtool/check.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Index: linux-2.6/tools/objtool/check.c
===================================================================
--- linux-2.6.orig/tools/objtool/check.c	2018-03-08 06:53:03.535471000 +0100
+++ linux-2.6/tools/objtool/check.c	2018-03-08 06:56:32.975471000 +0100
@@ -1131,13 +1131,13 @@ static int read_retpoline_hints(struct o
 		return -1;
 	}
 
-	if (sec->len % sizeof(unsigned long)) {
-		WARN("retpoline_safe size mismatch: %d %ld", sec->len, sizeof(unsigned long));
+	if (sec->len % sizeof(uint64_t)) {
+		WARN("retpoline_safe size mismatch: %d %d", sec->len, (int)sizeof(uint64_t));
 		return -1;
 	}
 
-	for (i = 0; i < sec->len / sizeof(unsigned long); i++) {
-		rela = find_rela_by_dest(sec, i * sizeof(unsigned long));
+	for (i = 0; i < sec->len / sizeof(uint64_t); i++) {
+		rela = find_rela_by_dest(sec, i * sizeof(uint64_t));
 		if (!rela) {
 			WARN("can't find rela for retpoline_safe[%d]", i);
 			return -1;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ