From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.160.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172007; b=S7Qybj97Zf7d+M5FpqPWRDu5Epu0yiAnq016lbAV/OWyGN20n6EP2oKXJUBwFYWnCSK5 PbXli8MBg+WgQFUnVDZOZrcvawg4BKiq8FCxANJsgQ8IUoq2oa4Isl6WE/CE28dbTBKEG m3mYycz84euX/evGTiAz9n2Ad9SEQVgjQfxHQVJ75xY7eQmiv3WbOdKNMxo8ywL+vPY28 zzGDhAfRa6wCXv7ZEzw8q/YAF7Gzg0q4rg8GnmWb9ufHGgaO+h5sucOoyoKoMuUm2RjLT ylSA37CwOFuhiYXZSJdRBJcMmiOGVIPdh+2mde0gAeV/trR8PHUTKVPrJN0J9A78XtQ== 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=JaIyWwRYADLj2b3lDcI2ko5NohrqeE3Ze0WsqdA0uD4OUfegq+31MsV/49U5mT7CYzxa sSu8GonVS8l60A7FqQBvNDUnOq7Xp19Z+HLuE/zrHmAKEDK0prBh58z7foV3M/+UMEPvc +ZcrVeFgihRWyTw61j1cXP+Y5FaX/w1ECQ0PL9zfxb9u2UBmU4U2d9NoUzRmWV9umwquP XJOwAQfagpGnDafbTZ6kevRufdH0iLFvLceYhGE4fH1h6ofRQUeXEwn7nFoSI8guMx7L+ xbmLqe3lmqKK0oYoPZAdXN3QhyMX8ftimL0qcsbIgy36S4sFqEbIuAhGvNU5HdKt3Rg== 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=KfvgGmd9; arc=none smtp.remote-ip=209.85.160.70 Received: from mail-oa1-f70.google.com (mail-oa1-f70.google.com [209.85.160.70]) (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 92534606A339 for ; Wed, 2 Dec 2026 00:40:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 92534606A339 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=KfvgGmd9 Received: by mail-oa1-f70.google.com with SMTP id 586e51a60fabf-448d51840c4so7618761fac.1 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=1796172006; x=1796776806; 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=KfvgGmd9+PbgCTjBjZ9MM9wtF61+XCXcSYjEkxcgrtEQW0R+DYzgXr3e70C2Hxp7XV 3n5WA/aTHVKMZgqztJdOhOH9jS2E9LUuJL30Qbm4tX77VuQRqM+c9ltmfgeR88Rf8pWv H19qF/TabmzKXq9OB0HVeWtHoPaIOEjoxzJ9zK2NfW2HuAgECh7M6Qo0jBhoIavpALeN cHV55W4khQt09lbQooo4/JlYfwdrPJKmYJFhFt5KmK+9Tojhoiu4KW7qCBTpFCbb1gBz Oy1nuty/KPGeTL78P+jUEnCboyA2B934LuSLXrNimO16SEkzlUbqjlcxwa1qMKCyyiZd q/og== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172006; x=1796776806; 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=e2tLn1Yu7SCddNOqWo5EtSR8KWJ2RVlRKmI6dLm7+2JDs+GEwbrmGZ00u31PPMRvN3 0t2NJ/RMZ5EFr6BsP98JhOjmbhugGVraeWXwIz/bmRIe8yUDpDdjLuuOCEEbZugQ2qSm nQE2tpEPUuN6Vm5IlrZBTEkEZwtn0y4j3uzkrWjq6mTPLyyTqvQnJEVereb5gtomySE/ QcbPe348gWdphmBQZIzkcWu4BPlRG48Z+ylI7xSxWU/YXwFhdotx54t0/KSCS3BM8FF2 QErhuOF2Kr6N6+w2y4+BJQ8tcWPjoeHwlyedBwcG+GblecytVc+A0LO/mLYtEW5ZLSz7 lxiQ== X-Forwarded-Encrypted: i=1; AL+hErG0tqLVgJjwcqIb2PA8Iky82VGy3enQFXBU3hAFuQgGwLpJ3JkHJ/izTKuCMjbcuCuRJoZ7aORFH91Q4i8=@vger.kernel.org X-Gm-Message-State: APuU4Z/qt1TUErZmGCiSUB7mXPxMOUBaSoUMNKF4JAcmiItIQv+p1OJB c63E1vyoQTaY7x09Bs8Pq0F1dvTBY43J7f5iGKP7hr5Gtr2qbRR0ILl9zz+Cr7eA6oqJwZC3OaE tXhodJXJgimTCOA== 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-kernel@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