From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C54A160A5BE0 for ; Wed, 2 Dec 2026 00:40:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=d0OciHiu; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=Ky/0+zUR DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:Cc:To:From: Subject:Message-ID:References:Mime-Version:In-Reply-To:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=uJvC/qw6s6ZQvSiC1jCR1WCUvDRQf7tfMBiMaKwhJQU=; b=d0OciHiuUNCZf4+Ta/Qk7fVHg/ jQ71nM9Sy+MI6B7IUkKRAmcEAyDx6+AXsiU8nsdbgkxPYnIei4caR37H49gbdCTCaui4siQJectTn KryOqhDxNMAJKBzjmt9sO4qAq9hm/O4zV6iCLBRP/+5avZuaCLo680O2asIVeN/WdzDQ+QIcIGKwJ PDKDTkWty4v8FKt9ASTww7yX6UbdrjhWqUoxOYOmc/x1qA275n7bJnL5zIlQTtVNcZ/ScmYW1iMXW 689Y+zHbDEmFhBTQvC+jDYlrYnCH5mrOcV4zjoMs2207533Mgpt8n7p3GSCQb8BC+mmT/19u85bLI Kd8VsWXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOP-00000009mB9-0GK9; Wed, 02 Dec 2026 00:40:17 +0000 Received: from mail-oi1-x246.google.com ([2607:f8b0:4864:20::246]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOG-00000009lwC-1Jvj for kexec@lists.infradead.org; Wed, 02 Dec 2026 00:40:12 +0000 Received: by mail-oi1-x246.google.com with SMTP id 5614622812f47-4e937c5bd4fso11126883b6e.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=lists.infradead.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=Ky/0+zUR99+qZHQobRtWNbsgMaJgyRMtIhSy4iFPw5lHVYjwLWQXu9HNgjNSwVQdvn 0jvBWYL856+w/7oPP5Bo6HQZ/CJEODQPjCTGhIkf6Bv6tPh1wrDRyetc2MabcT1OdECu Uc4b9oMEYj/VhqtaJpxbA5nXlcMGQdksZxJcQbZyRcdUd9lE0qsOxysYESRGJ75hR/Z2 ZcjmQwvis9LDJSTFCmhzmFL8u04FzIAkgojr8tyzC/CWgWWvq1fUsVbWFXYK3Kh0MPzW 9AFpPH2JNWkUnxgz5KBOOvOBbRkfLK+Y5khRyOZSTfVlPfD67KNm/twm86MTb5DRk7Jd KV9A== 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=vUZhFC3nzdhrL1Wi4BDo+Jwg6OO3KI78UP/Ea+fcPCTqpEkzPAc7pVI9oFVfKJx37t jkzfaLtEjEd4iBQnDQVEtN3QVQ1eFxVp+hvni6cdS63DfOkNDyEUhCred521bs6xaPC3 QMt3OS5mMtDly+g826Ic5Blmn10x3iyFTF8qqT6miU6Ok2AWwrItSl2wKTXuz4+VWjhh eY6Yi0kbx7zHOAPk+vvzu71vvRcvyWeB1bWuSq0pbFhBXyfx7AM2oyIqmWWP+16T5bp+ qqUzqPg3KFEzUe6M9VQ69eCcd3ghAWxafCZO3/Nt0nLwVD+NPK+Ebzkh2TwFQmuh7TNl cbRg== X-Gm-Message-State: APuU4Z9wI+KJ2oo/VN91wA2GtZ2/59Dwb1Bx//m4+wi/NA3Ck1WluFSh WN6F8sfgPX4MMvt4I5ARjSLoY8OxhP0lkc4RzUyEneE4mHyNMKN35GvhMvsnSboQrLmwuK57OZq P5OcltAjGF/c/XS2dhhJXJ3XpiglZWSB5fdU+FlzmCFSggIGdAH5r5qI8IHFF02D4wtNv7AvROG nxnxFeh6sGjyFjRDEOEID9PwIAbMukCshukdjoaJ0nz4EeYMIxFIs= 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-Archived-By: 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" X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_164008_392390_92A0326A X-CRM114-Status: GOOD ( 11.72 ) X-Spam-Score: -9.5 (---------) X-BeenThere: kexec@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kexec" X-Spam-Status: No, score=-26.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIMWL_WL_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT, USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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