From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.70 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796172004; b=v5s1nVoERzXpM9tKYykYveqDHnSu0vPSgk99dXZkFsqmAp1v2sDWJ6fYFQ8M+sQhv801 +0oYqNVeGpx65esG8lthfoAviysSuUdojxArcUFt4yECbFf5Ql2RR9HwFfjYq81BHXeYj QOu8OfhYZRNAdqMwhY+eIYbfKtndeHibQbJJGYNzHFlRBGIQMTrruvbQnV8cF6l7BzKlg IsBjmApxIbSEuWdp8RCgq1yYYssAT8fVLB6QHqxr8NKSSGkUm8bXA0kak3SO93tfvdQOs QFKDTNd6fCu5Nu/W0dTT5en87kVgxnYjttMFul9X6v4EO2wIVCNQxDSvoEA0A9VKgEg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796172004; 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=FkSCXQuEjN72Qu59EVeItljnnT76TyuuverwwE+ysiE=; b=mcBgoEa3Y+0U29v4F90wHyW/XmEs/JUB5UhjqHdf4nM0vm2wZRCEaT2joibbhDJ9j8dS VtnCImoQgo/AqlDL7bK9M2kkAJ7N+xVMBfiKDXCLlrVcKL8LUo/FtXUk8bbx/IKt5ryoI ZVe/Os0GB4tMWKtFOwpX2ecRVdMECwZEl1eNW59AHZW7QbMAg/37QH/+8fPLSnuVss2oc aaCzKK/y1MFUPqsFD0qfU1UCPyM+9ckB3oZ9v56FhC33K9InFCvc0iyyTd/jxLjsttB0E 2s2gp5YCRQnUPjV6uBQW832iY2SnAVr3/Tvv7jFyy2LKgmpgc52gj39+m8Do/SdrBBA== 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=mgbOQe5E; arc=none smtp.remote-ip=209.85.210.70 Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.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 47ACC606A6B4 for ; Wed, 2 Dec 2026 00:40:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 47ACC606A6B4 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=mgbOQe5E Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-83edc5c5ae9so11250500a34.1 for ; Tue, 01 Dec 2026 16:40:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20260707; t=1796172003; x=1796776803; 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=FkSCXQuEjN72Qu59EVeItljnnT76TyuuverwwE+ysiE=; b=mgbOQe5EK+FJ2vRhq4eGXnJQmKcL9mPHu2z1c9b1gc5SZh/KXboYU8Stw80RWzs1/r 6/tJFOxEeweAjaNMqPWcZP6+We2AWWr7eVoo7j6vTnO2TDj3QBnJyoj5NhTAnxBbtp+o 7ls+bV5sT1Yx4zJcepUTjvUPjmPtp54C77WpZMqNuFN/xRqXT3CwBDL5Mik9mwkR98eV m/S44P7NMEF1aKMwv5iE5ehqnJbAkFiL3XjL27rMkt77Bd/DI7Y54/frughepr1aeoTH X1r5TbnQMkCjCz3om35J+lwKPM9nNgiHbh9b6XRTM6xWH3GIPALmL3c16nrqbRhnevRm zYQw== 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=RJofwarRDutVg4MG0djT7D6p/7EOPqO9NcXXJMie/d7NKfiopJRcy7L3mLUi/sQP6/ ZymSZi6bNlIjVuKDsmWlxhnrW69SBmeDMZCZ1XWsYdqnZS9daIUxTn63Lo4VPyNN/gVa Rz6PrWX63OPMR0jU7ccmtzA9IUPs2TmH/9GhEJaCbq9JlEbZ/aStIGZ8Gpgx6MBvahN+ CnyNbFFA49rlK64F3LvHfjLqJjxvNgIr6GwIaYQuFudp3VS0nkBaRDeuiLzFeJkA5XBg U5dDYy/BpXLY2fwKKXQUElSvdVg1ByMuPBbw4XL3gclHd4HQUhg6d9VHSeE6uTj35PWM X5zA== X-Forwarded-Encrypted: i=1; AL+hErHJ7yikKeZ4fjCOkHxk7gou4snFwn2ydqgdFatXuOiCYChPBnLpFmczulW3mW3w9hHn3zVNVU0dri5G9rkg0lE=@vger.kernel.org X-Gm-Message-State: APuU4Z96FIIO3wWrcPHuazXGp2D2KNDnzo0P2H0DLg3GlkD5Oz3opnyl 68xVv0GdMy6A39cYsj4xLp4L8ju49o5Cf8wc5BzgCQp1WgXXotAjr6OwNnGbnXGWyiNS8nOwif7 10sKu5j/jvIJMYA== 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-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-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 Content-Type: text/plain; charset="UTF-8" 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