From nobody Mon Feb 9 20:10:20 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1702639163; cv=none; d=zohomail.com; s=zohoarc; b=i9TFDH0+KKwDJrwahO/D3f49zE621+QNgBfmpvZ+OoYtGi66v8ALMTW6L+NVkDicQsu6yInMBj0LOi7T75NwgQ6aY8xrof2gA+MTMKNklzPDBIk9RWUarW4LN5n0aqFBtccZPDg5jJ/MsCB/uJejttnmx3Po+KeOj+bCywoB5jg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1702639163; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=ZZlPTOk9/t1OmWoVhIbxLZaJgIzAgwV+V3DWNDNFJhM=; b=FQl7XLv09WvJXP7WMZtYNg5wfDc+HNG7wPsKTJ72loYyMYdUyqmLQ/5ubZEGMk6Laicux/n26EMvnkxWGmDzg6mc7MWWb0eNQhs+sg5Au9l0f7WlOxjM7Fq5JgtpSQNqZU8vEGD5/EEns3n5iAbgYWgLsvKra4DZ/bDcqkyqVP4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1702639163149471.50338835812624; Fri, 15 Dec 2023 03:19:23 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.655033.1022701 (Exim 4.92) (envelope-from ) id 1rE6Da-0002o1-61; Fri, 15 Dec 2023 11:18:58 +0000 Received: by outflank-mailman (output) from mailman id 655033.1022701; Fri, 15 Dec 2023 11:18:58 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rE6Da-0002lu-26; Fri, 15 Dec 2023 11:18:58 +0000 Received: by outflank-mailman (input) for mailman id 655033; Fri, 15 Dec 2023 11:18:57 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rE6DZ-00024C-0m for xen-devel@lists.xenproject.org; Fri, 15 Dec 2023 11:18:57 +0000 Received: from mail-wm1-x335.google.com (mail-wm1-x335.google.com [2a00:1450:4864:20::335]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id bc62f88d-9b3b-11ee-98ea-6d05b1d4d9a1; Fri, 15 Dec 2023 12:18:56 +0100 (CET) Received: by mail-wm1-x335.google.com with SMTP id 5b1f17b1804b1-40c38e292c8so2717515e9.0 for ; Fri, 15 Dec 2023 03:18:56 -0800 (PST) Received: from localhost ([213.195.127.70]) by smtp.gmail.com with ESMTPSA id y12-20020a5d614c000000b0033643505580sm5386737wrt.92.2023.12.15.03.18.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Dec 2023 03:18:54 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: bc62f88d-9b3b-11ee-98ea-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1702639135; x=1703243935; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZZlPTOk9/t1OmWoVhIbxLZaJgIzAgwV+V3DWNDNFJhM=; b=f3BLzzv5ZsU/UZqlYbkCDjgpO7r3L5wQQtBjDqhDuJs8Y6ujcceFYbAQSvhTYFGR2l 55VuGviFlAYAesWWedS/rWzi9Zt1ceNfj/GQVQkh0aBLj8ZsUpGSMGi5uyT/K1tQPd05 uNn8h+vcot3p9cQtwV/l8M9QIcLZnSjucIugc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702639135; x=1703243935; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZZlPTOk9/t1OmWoVhIbxLZaJgIzAgwV+V3DWNDNFJhM=; b=Z5MMlEJX8HUlQyQbwdNXUtf7W41sw1+TP9+GpuIfPCtUC687+H34p/iHvh6vufjUo7 hUEujAKOxnKpAD1Kwtc7miYlEMKOlIsYGJ6dQEMLQ01wkBNVHauvFFQI0jSTrEdQZhLp Vyysb6NfNuo2d/0Q7b1gQt6qfSbbMV4STcHfbX4yI7wo8XucwDSqdoti8i3iARKpwlej tGzqsEUWl9/eSf6Lpz5NVYRu8b7xuZr9CRn6t7vUQ/ad3KF86CGvCa4MEeTR87wrgFiw pzB56KfE3PWJYM73dtV3xy3QcsWI826hj+14tIKDPgCUbOGNdLzswhwzWZ3VgVeQGV4c Ee3w== X-Gm-Message-State: AOJu0Yzg8pLAxGWmDRqOsnZDWZsjdbLnIZsfeHqlf7PwSgyM5MC1AmvX l+upMLZ7ncsVCcBO6BCa+gNxWKTYscZeDKE85XM= X-Google-Smtp-Source: AGHT+IHQcoXi5iRHcJl9BtkyYNoOiiLzn01aWEKXAHCv8Vq7W5AiqIeHGveqt0nuPd3l7VKX8C1RcA== X-Received: by 2002:a05:600c:54e4:b0:40b:5e56:7b48 with SMTP id jb4-20020a05600c54e400b0040b5e567b48mr5458792wmb.145.1702639135024; Fri, 15 Dec 2023 03:18:55 -0800 (PST) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Doug Goldstein , Stefano Stabellini Subject: [PATCH v4 4/4] automation: add x86-64 livepatching test Date: Fri, 15 Dec 2023 12:18:42 +0100 Message-ID: <20231215111842.8009-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231215111842.8009-1-roger.pau@citrix.com> References: <20231215111842.8009-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1702639165042100002 Introduce a new gitlab tests for livepatching, using livepatch-build-tools, which better reflects how downstreams build live patches rather than the in-tree tests. The tests applies the dummy in-tree patch example, checks that the patch is applied correctly and then reverts and unloads it. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Stefano Stabellini --- Changes since v2: - Split livepatch build into a separate script. --- automation/gitlab-ci/build.yaml | 9 +++ automation/gitlab-ci/test.yaml | 8 +++ automation/scripts/build-livepatch | 27 ++++++++ .../scripts/qemu-alpine-x86_64-livepatch.sh | 68 +++++++++++++++++++ 4 files changed, 112 insertions(+) create mode 100755 automation/scripts/build-livepatch create mode 100755 automation/scripts/qemu-alpine-x86_64-livepatch.sh diff --git a/automation/gitlab-ci/build.yaml b/automation/gitlab-ci/build.y= aml index 32af30ccedc9..d770bffb845e 100644 --- a/automation/gitlab-ci/build.yaml +++ b/automation/gitlab-ci/build.yaml @@ -358,6 +358,15 @@ alpine-3.18-gcc-debug: variables: CONTAINER: alpine:3.18 =20 +alpine-3.18-gcc-livepatch: + extends: .gcc-x86-64-build + script: + - ./automation/scripts/build-livepatch 2>&1 | tee build.log + variables: + CONTAINER: alpine:3.18 + EXTRA_XEN_CONFIG: | + CONFIG_LIVEPATCH=3Dy + debian-stretch-gcc-debug: extends: .gcc-x86-64-build-debug variables: diff --git a/automation/gitlab-ci/test.yaml b/automation/gitlab-ci/test.yaml index 6aabdb9d156f..58a90be5ed0e 100644 --- a/automation/gitlab-ci/test.yaml +++ b/automation/gitlab-ci/test.yaml @@ -459,3 +459,11 @@ qemu-smoke-ppc64le-powernv9-gcc: needs: - qemu-system-ppc64-8.1.0-ppc64-export - debian-bullseye-gcc-ppc64le-debug + +qemu-alpine-x86_64-gcc-livepatch: + extends: .qemu-x86-64 + script: + - ./automation/scripts/qemu-alpine-x86_64-livepatch.sh 2>&1 | tee ${LO= GFILE} + needs: + - *x86-64-test-needs + - alpine-3.18-gcc-livepatch diff --git a/automation/scripts/build-livepatch b/automation/scripts/build-= livepatch new file mode 100755 index 000000000000..ac86b17ae5e4 --- /dev/null +++ b/automation/scripts/build-livepatch @@ -0,0 +1,27 @@ +#!/bin/bash -ex + +# Do a regular build first +./automation/scripts/build + +# Build a test livepatch using livepatch-build-tools. + +if [[ "$XEN_TARGET_ARCH" !=3D "x86_64" ]]; then + exit 1 +fi + +BASE=3Dxen/arch/x86/test/smoc-lp.c +ALT=3Dxen/arch/x86/test/smoc-lp-alt.c + +[[ -f $BASE && -f $ALT ]] + +# git diff --no-index returns 0 if no differences, otherwise 1. +git diff --no-index --output=3Dtest.patch $BASE $ALT && exit 1 + +BUILDID=3D$(readelf -Wn xen/xen-syms | sed -n -e 's/^.*Build ID: //p') + +git clone https://xenbits.xen.org/git-http/livepatch-build-tools.git +cd livepatch-build-tools +make +./livepatch-build -s ../ -p ../test.patch -o out -c ../xen/.config \ + --depends $BUILDID --xen-depends $BUILDID +cp out/test.livepatch ../binaries/test.livepatch diff --git a/automation/scripts/qemu-alpine-x86_64-livepatch.sh b/automatio= n/scripts/qemu-alpine-x86_64-livepatch.sh new file mode 100755 index 000000000000..da478cac4376 --- /dev/null +++ b/automation/scripts/qemu-alpine-x86_64-livepatch.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +set -ex + +cd binaries +# initrd.tar.gz is Dom0 rootfs +mkdir -p rootfs +cd rootfs +tar xvzf ../initrd.tar.gz +mkdir proc +mkdir run +mkdir srv +mkdir sys +rm var/run +cp -ar ../dist/install/* . +cp ../test.livepatch ./root/ +cat << "EOF" >> etc/local.d/xen-lp.start +#!/bin/bash + +set -ex + +trap poweroff EXIT + +export LD_LIBRARY_PATH=3D/usr/local/lib + +xen-livepatch test && exit 1 || true + +xen-livepatch load /root/test.livepatch + +# Cannot fail now +xen-livepatch test + +xen-livepatch revert test +xen-livepatch unload test + +xen-livepatch test && exit 1 || true + +echo "SUCCESS" +EOF +chmod +x etc/local.d/xen-lp.start +echo "rc_verbose=3Dyes" >> etc/rc.conf +# rebuild Dom0 rootfs +find . |cpio -H newc -o|gzip > ../xen-rootfs.cpio.gz +cd ../.. + +cat >> binaries/pxelinux.0 << EOF +#!ipxe + +kernel xen console=3Dcom1 console_timestamps=3Dboot +module bzImage console=3Dhvc0 +module xen-rootfs.cpio.gz +boot +EOF + +# Run the test +rm -f smoke.serial +timeout -k 1 360 \ +qemu-system-x86_64 \ + -cpu qemu64,+svm \ + -m 2G -smp 2 \ + -monitor none -serial stdio \ + -nographic \ + -device virtio-net-pci,netdev=3Dn0 \ + -netdev user,id=3Dn0,tftp=3Dbinaries,bootfile=3D/pxelinux.0 |& \ + tee smoke.serial | sed 's/\r//' + +grep -q "SUCCESS" smoke.serial +exit 0 --=20 2.43.0