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]
Message-ID: <Z0eqiayuv1w4a_dc@bombadil.infradead.org>
Date: Wed, 27 Nov 2024 15:26:01 -0800
From: Luis Chamberlain <mcgrof@...nel.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: samitolvanen@...gle.com, petr.pavlu@...e.com, da.gomez@...sung.com,
	linux-modules@...r.kernel.org, patches@...ts.linux.dev,
	linux-kernel@...r.kernel.org, masahiroy@...nel.org,
	mmaurer@...gle.com, arnd@...db.de, deller@....de, song@...nel.org
Subject: Re: [GIT PULL] Modules changes for v6.13-rc1

On Wed, Nov 27, 2024 at 02:35:36PM -0800, Luis Chamberlain wrote:
> Sorry about that, I'm on it.

OK here is a fix, goes double build tested and then run time tested.

>From 6c9ef19d7676c3f650f1de3e2619c958f21c0b75 Mon Sep 17 00:00:00 2001
From: Luis Chamberlain <mcgrof@...nel.org>
Date: Wed, 27 Nov 2024 14:10:57 -0800
Subject: [PATCH] selftests: kallsyms: fix with sensible defaults

Folks use 'make allmodconfig' to test building Linux, and although
the test is intended to stress test that and later load insane modules,
we don't need to make 'make allmodconfig' suffer. So scale down to
the bare bones by default.

To do this be explicit about the sensible ranges and bound the test
so that folks who the impact if they enable more broader range test
options.

This also helps us clarify where we run into existing limits today.

Also, avoid the stupid FORCE so that re-builds will only trigger
when really needed.

Reported-by: Linus Torvalds <torvalds@...ux-foundation.org>
Signed-off-by: Luis Chamberlain <mcgrof@...nel.org>
---
 lib/Kconfig.debug                     | 38 ++++++++++++++++++++++++++-
 lib/tests/module/Makefile             |  2 +-
 lib/tests/module/gen_test_kallsyms.sh |  9 +++++--
 3 files changed, 45 insertions(+), 4 deletions(-)

diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
index b5929721fc63..31b843690a00 100644
--- a/lib/Kconfig.debug
+++ b/lib/Kconfig.debug
@@ -2986,9 +2986,43 @@ config TEST_KALLSYMS_D
 	tristate
 	depends on m
 
+choice
+	prompt "Kallsym test range"
+	default TEST_KALLSYMS_FAST
+	help
+	  Selecting something other than "Fast" will enable tests which slow
+	  down the build and may crash your build.
+
+config TEST_KALLSYMS_FAST
+	bool "Fast builds"
+	help
+	  You won't really be testing kallsysms, so this just helps fast builds
+	  when allmodconfig is used..
+
+config TEST_KALLSYMS_LARGE
+	bool "Enable testing kallsyms with large exports"
+	help
+	  This will enable larger number of symbols. Only enable this if you
+	  are a modules developer. This will slow down your build considerbly
+	  by at least 2x.
+
+config TEST_KALLSYMS_MAX
+	bool "Known kallsysms limits"
+	help
+	  This will enable exports to the point we know we'll start crashing
+	  builds.
+
+endchoice
+
+
 config TEST_KALLSYMS_NUMSYMS
 	int "test kallsyms number of symbols"
-	default 100
+	range 2 8 if TEST_KALLSYMS_FAST
+	range 8 100 if TEST_KALLSYMS_LARGE
+	range 100 1000 if TEST_KALLSYMS_MAX
+	default 2 if TEST_KALLSYMS_FAST
+	default 8 if TEST_KALLSYMS_LARGE
+	default 100 if TEST_KALLSYMS_MAX
 	help
 	  The number of symbols to create on TEST_KALLSYMS_A, only one of which
 	  module TEST_KALLSYMS_B will use. This also will be used
@@ -2997,6 +3031,8 @@ config TEST_KALLSYMS_NUMSYMS
 	  trigger a segfault today, don't use anything close to it unless
 	  you are aware that this should not be used for automated build tests.
 
+	  We use sensible default to not slow down default allmodconfig builds.
+
 config TEST_KALLSYMS_SCALE_FACTOR
 	int "test kallsyms scale factor"
 	default 8
diff --git a/lib/tests/module/Makefile b/lib/tests/module/Makefile
index af5c27b996cb..5436386d7aa0 100644
--- a/lib/tests/module/Makefile
+++ b/lib/tests/module/Makefile
@@ -3,7 +3,7 @@ obj-$(CONFIG_TEST_KALLSYMS_B) += test_kallsyms_b.o
 obj-$(CONFIG_TEST_KALLSYMS_C) += test_kallsyms_c.o
 obj-$(CONFIG_TEST_KALLSYMS_D) += test_kallsyms_d.o
 
-$(obj)/%.c: FORCE
+$(obj)/%.c: $(srctree)/lib/tests/module/gen_test_kallsyms.sh $(KCONFIG_CONFIG)
 	@$(kecho) "  GEN     $@"
 	$(Q)$(srctree)/lib/tests/module/gen_test_kallsyms.sh $@\
 		$(CONFIG_TEST_KALLSYMS_NUMSYMS) \
diff --git a/lib/tests/module/gen_test_kallsyms.sh b/lib/tests/module/gen_test_kallsyms.sh
index 3f2c626350ad..561dcac0f359 100755
--- a/lib/tests/module/gen_test_kallsyms.sh
+++ b/lib/tests/module/gen_test_kallsyms.sh
@@ -7,6 +7,11 @@ NUM_SYMS=$2
 SCALE_FACTOR=$3
 TEST_TYPE=$(echo $TARGET | sed -e 's|lib/tests/module/test_kallsyms_||g')
 TEST_TYPE=$(echo $TEST_TYPE | sed -e 's|.c||g')
+FIRST_B_LOOKUP=1
+
+if [[ $NUM_SYMS -gt 2 ]]; then
+	FIRST_B_LOOKUP=$((NUM_SYMS/2))
+fi
 
 gen_template_module_header()
 {
@@ -52,10 +57,10 @@ ____END_MODULE
 
 gen_template_module_data_b()
 {
-	printf "\nextern int auto_test_a_%010d;\n\n" 28
+	printf "\nextern int auto_test_a_%010d;\n\n" $FIRST_B_LOOKUP
 	echo "static int auto_runtime_test(void)"
 	echo "{"
-	printf "\nreturn auto_test_a_%010d;\n" 28
+	printf "\nreturn auto_test_a_%010d;\n" $FIRST_B_LOOKUP
 	echo "}"
 }
 
-- 
2.45.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ