From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.167.200 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172007; b=An6Lc3h4mAtKdkOnAqIMyKWvgJxNs3qB1y1FYhhhMCnGtlCxpvYkq6FnBV9VoiEhQlqJ xhkZsTKIUX/2KL1go1BcQdLcx4nOmLwb14nYehgQSf/mp1JvvOnzM5pfkOqtMqHyC+Gxd a4Uoq7gS+VNs0fqsMiG2nP/r+dg9WD/X/RdT4FFsdo5Fbkix4uHz6Xs/E9suBtmcms0bQ PpT12uJMuH3d+DVXe2vS1N2ktUv4XdYdy+8Ae7fHalqxlP8vmR9yG5MF6Be5TqUlLdHLc TFUiK/Uv5WJRADSBDpPpZu96OuarKFn0VegpjWJ1k0wlHqRJNTcvosxkhpogpJNIErw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172007; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:Date:In-Reply-To: Mime-Version:References:X-Mailer:Message-ID:Subject:From:To:Cc: Content-Type; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=wpLRe4SQGuzw94shTggPTf86TQqS65n0+ZJMS7WMWGvdzm7QpNiti5Q5J1VV6DWnjqeD bVkeK9k9Cm+3v3a73JFjRqJQh78o7c5IF3j2UmB4Wdjj297J81qLak7O7m821kkp9RPBo DPUywrM6mKd26w3noSDWWpKR+RXB79Mr4rvkXZdLO9KfgN2Sz94lAZR587gqeV5fQgHLV 26aANlLgIzXI026aVXzTMNuCMYskp1qrk215WAZF+HAPoX8ygvhAZdHs+pSUd+LC4L0Kd LQEKbkCUpTR/Y7OTJu0tZ2qcci2JK2b8tfOnqLdibnfHenA2PFGVpIx0fyalHjiFREg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=google.com; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com; dkim=pass header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=dd5JTyG1; arc=none smtp.remote-ip=209.85.167.200 Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7963A606A688 for ; Wed, 2 Dec 2026 00:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7963A606A688 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--dmatlack.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=dd5JTyG1 Received: by mail-oi1-f200.google.com with SMTP id 5614622812f47-4e937c5bd4fso11126881b6e.2 for ; Tue, 01 Dec 2026 16:40:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172007; x=1796776807; darn=vger.kernel.org; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:from:to:cc:subject:date:message-id:reply-to :content-type; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=dd5JTyG1K1sDhBoKIXyCmvocQBwlTmAVn4BEXK7scwRAxDM9eY1BxQCs28YvXMAnmZ 4N/IuWjZ24hvknPBkK2LJZg8uYbP0yg3hNOauIUSyq68+rDRfQLO+NgjzfZ+nTZOC6kD AKo4HeJFsWJN8x8p8/lPIpAMqjl0JbJZaFurcX5BVWVHKpyUd3mGTuUFGjjhm9X+oe1U 8noIdwkOo5gql9d+KpN4PqTTD/7qle7+LVrEzMX+aIcHoUvJtX/2Uw7zjePn3DSXH2RL ukARF2/GmgPzPA1+3DkzqKXBT9/J8Y7RjURVBweNDRha34KQzmMnfDd+oo/+kQjbYtH3 zhKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172007; x=1796776807; h=content-type:cc:to:from:subject:message-id:references:mime-version :in-reply-to:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=0IRJ9ZbK+7dNEMx8Lb9ByNDvEtao76lvmmpne3dv3iKdvwyWy+/0U/YKZMjNfp3M4C MfBcSEJtjCdM+wAVojqPwAbBkNeeEhU6slrZCUYoNO+tBnZaMKJOkcBvc/8jR8casX+j 322iI5orNVcgPDR/4RIoTzM6W0voo0BcgXLsOZosAGh0vu5SxGHybgN8TVzs27hh42UD RMS1NICnARHjikPSd6GOddM2SXCD4ScmLLp4P+g4ajZzfOsWVUBMGfATVQt695PgH/Dt IpdXlSqggAB26w8/pBMjobhwrE0/as6u/2jCxPjf2e0RX+sIe5cEfDbGpdm5o8BaGRLY ElRg== X-Forwarded-Encrypted: i=1; AL+hErEInTGtT82smZVMrpZiKwAiWR6sKd9o29IPMsF/ahPji/awFSxGUqVAqTY8+Xy1Lb2F8joIuvIiwUrVNL81PrU=@vger.kernel.org X-Gm-Message-State: APuU4Z8NHeYq0KgDDPEY5OFKxZWdYOHS76NvBIT8lnqlic2vJswsTQSU p4TjqZ8EmwvS8/4Q7obIpJIgSkH2sfCKjolaz/mUyWGiRRQLcoUNsw6z6dzCjNNqqm22M+zyJxW uanQmIJjRvaK2og== X-Received: from jabio27.prod.google.com ([2002:a05:6638:831b:b0:608:c2f0:a34d]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:13d5:b0:53b:1d13:dffd with SMTP id 5614622812f47-57a06a11405mr40218668b6e.7.1796172006403; Tue, 01 Dec 2026 16:40:06 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:44 +0000 In-Reply-To: <20261202003955.3607156-1-dmatlack@google.com> X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Mime-Version: 1.0 References: <20261202003955.3607156-1-dmatlack@google.com> X-Mailer: git-send-email 2.56.1.911.g883d8bcb20-goog Message-ID: <20261202003955.3607156-8-dmatlack@google.com> Subject: [PATCH 07/18] selftests/liveupdate: Support kernel modules in vmtest.sh From: David Matlack To: kexec@lists.infradead.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-pci@vger.kernel.org, linux-riscv@lists.infradead.org Cc: Albert Ou , Alexandre Ghiti , Alex Williamson , Bjorn Helgaas , David Matlack , Jacob Pan , Jason Gunthorpe , Josh Hilke , Lukas Wunner , Mike Rapoport , Palmer Dabbelt , Parav Pandit , Pasha Tatashin , Paul Walmsley , Pranjal Shrivastava , Pratyush Yadav , Samiullah Khawaja , Shuah Khan , Vipin Sharma Content-Type: text/plain; charset="UTF-8" Add TEST_MODULES to vmtest.sh test definitions. vmtest.sh builds the modules in the Makefile's TEST_GEN_MODS_DIR against the test kernel, and places the listed modules at the root of both kernels' initrds, where the test binary can load them. The modules are built with MO= so that their build output goes into the workspace rather than the source tree. The kernel's own modules are built too, since external modules need Module.symvers. Signed-off-by: David Matlack --- tools/testing/selftests/liveupdate/vmtest.sh | 24 ++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tools/testing/selftests/liveupdate/vmtest.sh b/tools/testing/selftests/liveupdate/vmtest.sh index 797190d4b47c..937f10fc9592 100755 --- a/tools/testing/selftests/liveupdate/vmtest.sh +++ b/tools/testing/selftests/liveupdate/vmtest.sh @@ -21,10 +21,13 @@ KEEP_WORKSPACE=0 # TEST_BINARY Test binary to run, as named in the Makefile # (default: the test name) # TEST_ARGS Arguments for the test binary in both stages +# TEST_MODULES Kernel modules to place at /.ko in the +# initrd, built from the Makefile's TEST_GEN_MODS_DIR # TEST_QEMU_ARGS Extra QEMU arguments # TEST_TIMEOUT Timeout for the QEMU run # test_check() Host-side check, run after the test passes in the VM TEST_ARGS=() +TEST_MODULES=() TEST_QEMU_ARGS=() TEST_TIMEOUT="30s" @@ -152,6 +155,11 @@ function build_kernel() { $make_cmd "$kimage" $make_cmd headers_install INSTALL_HDR_PATH="$headers_dir" + + # External modules need Module.symvers + if [ ${#TEST_MODULES[@]} -gt 0 ]; then + $make_cmd modules + fi } function mkinitrd() { @@ -161,12 +169,26 @@ function mkinitrd() { local output="$workspace_dir/build" local init="$output/init" local test_binary="$output/$TEST_BINARY" + local extra_files="$workspace_dir/cpio_list_extra" + local module ko # Build the test binary and the init process mkdir -p "$output" $make_cmd -C "$test_dir" NOLIBC=1 OUTPUT="$output" \ KHDR_INCLUDES="-I$headers_dir/include" "$init" "$test_binary" + # Build the test modules against the test kernel, and place the ones + # the test needs in both initrds + : > "$extra_files" + if [ ${#TEST_MODULES[@]} -gt 0 ]; then + $make_cmd -C "$test_dir" KDIR="$build_dir" MO="$output/modules" gen_mods_dir + fi + for module in "${TEST_MODULES[@]}"; do + ko="$output/modules/$module.ko" + [ -f "$ko" ] || fail "Module $module was not built" + echo "file /$module.ko $ko 0644 0 0" >> "$extra_files" + done + # init passes these to the test binary in both stages echo "${TEST_ARGS[*]}" > "$workspace_dir/test_args" @@ -179,6 +201,7 @@ file /init $init 0755 0 0 file /test_binary $test_binary 0755 0 0 file /test_args $workspace_dir/test_args 0644 0 0 EOF + cat "$extra_files" >> "$workspace_dir/cpio_list_inner" # Generate inner_initrd.cpio "$build_dir/scripts/gen_init_cpio" "$workspace_dir/cpio_list_inner" > "$workspace_dir/inner_initrd.cpio" @@ -194,6 +217,7 @@ file /test_binary $test_binary 0755 0 0 file /test_args $workspace_dir/test_args 0644 0 0 file /initrd.img $workspace_dir/inner_initrd.cpio 0644 0 0 EOF + cat "$extra_files" >> "$workspace_dir/cpio_list" # Generate the final initrd "$build_dir/scripts/gen_init_cpio" "$workspace_dir/cpio_list" > "$initrd" -- 2.56.1.911.g883d8bcb20-goog