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]
Message-Id: <20200910153204.156871-1-linux@roeck-us.net>
Date:   Thu, 10 Sep 2020 08:32:04 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Masahiro Yamada <masahiroy@...nel.org>
Cc:     Michal Marek <michal.lkml@...kovi.net>,
        linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
        Guenter Roeck <linux@...ck-us.net>,
        Geert Uytterhoeven <geert@...ux-m68k.org>
Subject: [PATCH] kbuild: Try up to eight kallsyms link passes

Since v5.8, powerpc:allmodconfig often fails to build with the following
error message.

	Inconsistent kallsyms data
	Try make KALLSYMS_EXTRA_PASS=1 as a workaround

Setting KALLSYMS_EXTRA_PASS=1 does not help. As it turns out, the build
currently needs up to four link passes to succeed.

Similar problems have been observed over time for other architectures.

Make the number of link passes dynamic to solve the problem. Try up to
eight passes before giving up. If KALLSYMS_EXTRA_PASS is set, add one
additional pass after succeeding.

Suggested-by: Geert Uytterhoeven <geert@...ux-m68k.org>
Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
 scripts/link-vmlinux.sh | 31 +++++++++++++++++++------------
 1 file changed, 19 insertions(+), 12 deletions(-)

diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index e6e2d9e5ff48..72abdee0e649 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -316,11 +316,10 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
 	#     From here, we generate a correct .tmp_kallsyms2.o
 	# 3)  That link may have expanded the kernel image enough that
 	#     more linker branch stubs / trampolines had to be added, which
-	#     introduces new names, which further expands kallsyms. Do another
-	#     pass if that is the case. In theory it's possible this results
-	#     in even more stubs, but unlikely.
-	#     KALLSYMS_EXTRA_PASS=1 may also used to debug or work around
-	#     other bugs.
+	#     introduces new names, which further expands kallsyms. Try up
+	#     to eight passes to handle that situation before giving up.
+	#     KALLSYMS_EXTRA_PASS=1 may be used to add an extra step
+	#     for debugging or to work around other bugs.
 	# 4)  The correct ${kallsymso} is linked into the final vmlinux.
 	#
 	# a)  Verify that the System.map from vmlinux matches the map from
@@ -329,13 +328,21 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
 	kallsyms_step 1
 	kallsyms_step 2
 
-	# step 3
-	size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
-	size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
-
-	if [ $size1 -ne $size2 ] || [ -n "${KALLSYMS_EXTRA_PASS}" ]; then
-		kallsyms_step 3
-	fi
+	# step n
+	step=3
+	while [ $step -le 8 ]; do
+		size1=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso_prev})
+		size2=$(${CONFIG_SHELL} "${srctree}/scripts/file-size.sh" ${kallsymso})
+
+		if [ $size1 -eq $size2 ]; then
+			if [ -z "${KALLSYMS_EXTRA_PASS}" ]; then
+				break
+			fi
+			KALLSYMS_EXTRA_PASS=""
+		fi
+		kallsyms_step $step
+		step="$(expr $step + 1)"
+	done
 fi
 
 vmlinux_link vmlinux "${kallsymso}" ${btf_vmlinux_bin_o}
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ