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 6D05C60A6F52 for ; Wed, 2 Dec 2026 00:40:18 +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=ym8hkwhg; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.a=rsa-sha256 header.s=20260707 header.b=OezTy8aY DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Unsubscribe-Post:List-Owner; bh=K3VEIol5ogh+7Zt2DmYzIYAvNynVGT6lFkQk3Onvbjg=; b=ym8hkwhgbYNB5iAfO7H3z2eWoy xOR6ZW3QPIhObrta5Rfdkukdan1yaclVN7u1A9MaGcP7LDlrrwlzxHCuo9IOt46msusDh10LVgdaZ j5l8CkPUYY0sSZcBXA+whmh/oJNmdNFWEPZQxrmJWFPvs4fNf6xa6Ys9vh0DClDYlzYya3xuLnsjL 3+SJ/apCBKUo7tTR70XpM2NtWOh0HXy0YRIRwHqFA+eNyp7SXDl4kXjvCpA6AMxUZ5m7usTIyq2lm xwj2yxX3yiHPuqB0lDPqxQsXCOSqSS4f31vHtHzWekfteD4Hdd4vfapa31f+LfcRU4QEul5yIVE2T u/TjrrOQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOK-00000009m2I-1RIX; Wed, 02 Dec 2026 00:40:12 +0000 Received: from mail-oi1-x248.google.com ([2607:f8b0:4864:20::248]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYYOC-00000009lsl-1tP5 for linux-riscv@lists.infradead.org; Wed, 02 Dec 2026 00:40:07 +0000 Received: by mail-oi1-x248.google.com with SMTP id 5614622812f47-4cbf700ddccso9204668b6e.0 for ; Tue, 01 Dec 2026 16:40:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172003; x=1796776803; 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=FkSCXQuEjN72Qu59EVeItljnnT76TyuuverwwE+ysiE=; b=OezTy8aYNaiSKKUIzhNJB+sXc9eiAPzade2eBJZ7CIH6rmmQYfmAzS9o4M7Vrge3mn YNRJkk54UZA5MhH8WBKccre0JKsr4qOPdagCNWAUJUKpfsX6bm9aDFL7uLkoceQYQMJn kvhwtbr0UCgGtS1+apQjtQ8OtWbWTySJhi8yoautSUbwsbioziUy48VmR7EPEjuHJpby EamaTMMOi0iPUy+aTeNSIrkOvC8PBzJf3I3qXa18zpbbyIaA9BRVM9/TZb33dLJ425iC xSUXLD4Bh/SVGcHT/GGfQ3WfTsbWTVRsXZXNNOAOCAA5mN/7/NNN7aVR4Lxiwd66oE2F SeIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796172003; x=1796776803; 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=FkSCXQuEjN72Qu59EVeItljnnT76TyuuverwwE+ysiE=; b=eL2hie9dbl6yccw1gP6ycbvpjv0xykZZ4OpjiIs8C6phyFkC3i054s9iupcC3VbYV6 OHojnacb7QdSA7wh50INSnaPvdsyzzgKe8kY4mtsfHoGOrlCeEh6iO1eTd0GcklGw2xu o/FrU2/przKG4Nevsw3SmxPecv8UyI4d0dixVrMzase9A15y3jtjiVpnh1n2Qmk0XVTP kCkrYCUljJlUDVM2O+CxSmRSRjdO4NSdqWyCj+SkvO5ks3NIA99P1ZyVh3eOtq3VbZ8u yxMHM9/5Wzx/zBIsmeni6CJUuGZ6967ltRq3k7/DgyOJVyGmIVmCl9yG64M+GRvn+VjA ToFw== X-Forwarded-Encrypted: i=1; AL+hErHoFihLHKed7GiBEfj0hBhLp/ibIaQKozPToUr0Cb0tD6xIxvz88kbEGb23hgvk+HmFdM9ZxM+S2+CUeg==@lists.infradead.org X-Gm-Message-State: APuU4Z+8Id6hRStwraFsZf9f2kRXPJGVvZmS7SfPVU1sXNaymK1av5yB DnniD/GnW+N5IMUY5SQA1HgSXR3DEzS1Vrbdwctqm4+q2c+R12muzipjs5Fg0WQvWgrvvY8rZze eITiE2efl4eHX1A== X-Received: from ilec9-n2.prod.google.com ([2002:a05:6e02:6149:20b0:550:20ce:9237]) (user=dmatlack job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6808:c40e:b0:571:76cb:b4d2 with SMTP id 5614622812f47-57a0b03eeabmr47147841b6e.38.1796172002960; Tue, 01 Dec 2026 16:40:02 -0800 (PST) Date: Wed, 2 Dec 2026 00:39:41 +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-5-dmatlack@google.com> Subject: [PATCH 04/18] selftests/liveupdate: Support building the kexec tests against nolibc 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261201_164004_508693_420D6B6E X-CRM114-Status: GOOD ( 14.59 ) X-Spam-Score: -9.5 (---------) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 a NOLIBC=1 mode to the liveupdate selftests Makefile, which builds the tests that run across kexec, and the init process that runs them in vmtest.sh's VMs, as static binaries against nolibc. vmtest.sh builds these binaries with its own compiler invocations today, and this mode will let it use the Makefile instead. The liveupdate test is not built in this mode since it uses the kselftest harness, which requires libc. make clean removes the binaries of both modes. Fix two warnings in init.c that show up now that it is built with -Wall: an unused variable, and status possibly being used uninitialized if waitpid() fails. Signed-off-by: David Matlack --- tools/testing/selftests/liveupdate/Makefile | 13 +++++++++++++ tools/testing/selftests/liveupdate/init.c | 4 ++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/liveupdate/Makefile b/tools/testing/selftests/liveupdate/Makefile index 31517a07f531..df0567e8ca15 100644 --- a/tools/testing/selftests/liveupdate/Makefile +++ b/tools/testing/selftests/liveupdate/Makefile @@ -1,6 +1,13 @@ # SPDX-License-Identifier: GPL-2.0-only +# With NOLIBC=1, build the tests that run across kexec, and the init process +# that runs them, as static binaries against nolibc. vmtest.sh uses this to +# build the initrds for its VMs. +ifeq ($(NOLIBC),) TEST_GEN_PROGS += liveupdate +else +TEST_GEN_FILES += init +endif TEST_GEN_PROGS_EXTENDED += luo_kexec_simple TEST_GEN_PROGS_EXTENDED += luo_multi_session @@ -12,6 +19,9 @@ TEST_FILES += do_kexec.sh include ../lib.mk include lib/libliveupdate.mk +ifneq ($(NOLIBC),) +CFLAGS += -static -nostdlib -nostdinc -I$(top_srcdir)/tools/include/nolibc +endif CFLAGS += $(KHDR_INCLUDES) CFLAGS += -Wall -O2 -Wno-unused-function CFLAGS += -MD @@ -31,4 +41,7 @@ $(TEST_GEN_PROGS) $(TEST_GEN_PROGS_EXTENDED): $(OUTPUT)/%: $(OUTPUT)/%.o $(LIBLI $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $< $(LIBLIVEUPDATE_O) $(LDLIBS) -o $@ EXTRA_CLEAN += $(TEST_O) +# Clean up the binaries of both modes regardless of NOLIBC. +EXTRA_CLEAN += $(OUTPUT)/liveupdate $(OUTPUT)/liveupdate.o $(OUTPUT)/liveupdate.d +EXTRA_CLEAN += $(OUTPUT)/init $(OUTPUT)/init.d EXTRA_CLEAN += $(TEST_DEP_FILES) diff --git a/tools/testing/selftests/liveupdate/init.c b/tools/testing/selftests/liveupdate/init.c index fb08bd58b9b9..824c9da2facf 100644 --- a/tools/testing/selftests/liveupdate/init.c +++ b/tools/testing/selftests/liveupdate/init.c @@ -115,7 +115,8 @@ static int run_test(int stage) _exit(1); } - waitpid(pid, &status, 0); + if (waitpid(pid, &status, 0) < 0) + return -1; return (WIFEXITED(status) && WEXITSTATUS(status) == 0) ? 0 : -1; } @@ -144,7 +145,6 @@ static int get_current_stage(void) int main(int argc, char *argv[]) { int current_stage; - int err; if (mount_filesystems()) goto err_reboot; -- 2.56.1.911.g883d8bcb20-goog _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv