On Sat, May 07, 2022 at 01:02:20AM -0700, Luis Chamberlain wrote: > You can try to reproduce by using adding a new test type for crypto-aegis256 > on lib/test_kmod.c. These tests however can try something similar but other > modules. > > /tools/testing/selftests/kmod/kmod.sh -t 0008 > /tools/testing/selftests/kmod/kmod.sh -t 0009 > > I can't decipher this yet. Without testing it... but something like this might be an easier reproducer: diff --git a/tools/testing/selftests/kmod/kmod.sh b/tools/testing/selftests/kmod/kmod.sh index afd42387e8b2..48b6b5ec6c1e 100755 --- a/tools/testing/selftests/kmod/kmod.sh +++ b/tools/testing/selftests/kmod/kmod.sh @@ -41,6 +41,7 @@ set -e TEST_NAME="kmod" TEST_DRIVER="test_${TEST_NAME}" TEST_DIR=$(dirname $0) +PROC_CONFIG="/proc/config.gz" # This represents # @@ -65,6 +66,7 @@ ALL_TESTS="$ALL_TESTS 0010:1:1" ALL_TESTS="$ALL_TESTS 0011:1:1" ALL_TESTS="$ALL_TESTS 0012:1:1" ALL_TESTS="$ALL_TESTS 0013:1:1" +ALL_TESTS="$ALL_TESTS 0014:150:1" # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 @@ -79,6 +81,19 @@ test_modprobe() fi } +kconfig_has() +{ + if [ -f $PROC_CONFIG ]; then + if zgrep -q $1 $PROC_CONFIG 2>/dev/null; then + echo "yes" + else + echo "no" + fi + else + echo "no" + fi +} + function allow_user_defaults() { if [ -z $DEFAULT_KMOD_DRIVER ]; then @@ -106,6 +121,8 @@ function allow_user_defaults() fi MODPROBE_LIMIT_FILE="${PROC_DIR}/kmod-limit" + HAS_CRYPTO_AEGIS256_MOD="$(kconfig_has CONFIG_CRYPTO_AEGIS256=m)" + HAS_CRYPTO_AEGIS256_BUILTIN="$(kconfig_has CONFIG_CRYPTO_AEGIS256=y)" } test_reqs() @@ -504,6 +521,21 @@ kmod_test_0013() "cat /sys/module/${DEFAULT_KMOD_DRIVER}/sections/.*text | head -n1" } +kmod_test_0014() +{ + kmod_defaults_driver + MODPROBE_LIMIT=$(config_get_modprobe_limit) + let EXTRA=$MODPROBE_LIMIT/6 + config_set_driver crypto-aegis256 + config_num_thread_limit_extra $EXTRA + config_trigger ${FUNCNAME[0]} + if [[ "$HAS_CRYPTO_AEGIS256_MOD" == "yes" || "$HAS_CRYPTO_AEGIS256_BUILTIN" == "yes" ]]; then + config_expect_result ${FUNCNAME[0]} SUCCESS + else + config_expect_result ${FUNCNAME[0]} MODULE_NOT_FOUND + fi +} + list_tests() { echo "Test ID list:" @@ -525,6 +557,7 @@ list_tests() echo "0011 x $(get_test_count 0011) - test completely disabling module autoloading" echo "0012 x $(get_test_count 0012) - test /proc/modules address visibility under CAP_SYSLOG" echo "0013 x $(get_test_count 0013) - test /sys/module/*/sections/* visibility under CAP_SYSLOG" + echo "0014 x $(get_test_count 0014) - multithreaded - push kmod_concurrent over max_modprobes for request_module() for crypto-aegis256" } usage()