Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1393167lqp; Fri, 22 Mar 2024 13:31:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTnjgcIMcSbM5ZNChtuZfMaE5i2EUqfAhLPSCVWsJ7JAmLgn9r5+s0k/H0XGRWt6w9utczn7MypKhf1IBlcMfknEslITfHeALVyfC68w== X-Google-Smtp-Source: AGHT+IFumgEoIsqLMLR6g6+TjbLYhWtc0vcCIH37DaombB61L0gd8GbFaD4Gj9sRTf7tiyOekOL5 X-Received: by 2002:a05:6102:678:b0:476:c9e4:406b with SMTP id z24-20020a056102067800b00476c9e4406bmr769893vsf.20.1711139516263; Fri, 22 Mar 2024 13:31:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711139516; cv=pass; d=google.com; s=arc-20160816; b=qkoydwKwh/6iyrcsYNhG6iAobv25M020ZUWgaIOybTXrBstQ+cR1ScsP6CcM297TMu HE5Guw9JUCrPugXPjhqdqnzRnyH05OM4ciDuLpOllF+ZMBAh8HVr26VrHVQTB3rfUeXe 3AJTl910Rvjj0GNTyxwL6tBppBDYmLdK+iwcWZxN5gNZqEp9tutUgWXEKVYRHE8V9KQv hLwNKQF0ZG3POSR/gbwWV/+sGzCLZzdfpxvXBh4qfDxBjfRpxLowSgC346K4hvJrbAM9 2KpnD7kzyGSkTdCHjP1ScxRWqABc3G3QBl63eMfgK88vouGujyfZ0V93Sr8Sj2HOUHWy xSRQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id:dkim-signature; bh=bkEtvYqy1WvJcxiq2A/RIrn4954G/qQAXJYaM8Oh1Rc=; fh=jzehJDbQH4l2fkIom/X8JByItDlZzivCdgOhk68yzWU=; b=kdwmmu2Om/PGWhnuydu/DrDhRheA8TAd2Ug9rlrGN3mPctyceBvz02S7GLo9mX+X4a TU9j7DTl6nL8OcH1OWb8FNvkCKPkpE48CROkINITY/TIZIuegPhxgdJwDIDM7WkTWWym abiB2G0NKKMr/C47kni6Ogc2iqpRFarUneC104GxPwaiVWVRvOVMvJOyncXJ7fNrelJh Z+nW4FHr8SSJH3gxZxNVHtqZEoJEEDq3DUsrJi30w29n4WH+DpSgLsL5ojS3hto08MZM az+VVfitOZttkq1sDPPoGGcUSIlyA1h+gEE8igyE8heped6O/CrZLcfz0B7qAY7dyFo8 OutA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=f9ShoMH8; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-112014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id ih14-20020a0561022d0e00b00476ae6c5b23si113303vsb.236.2024.03.22.13.31.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 13:31:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-112014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=f9ShoMH8; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel+bounces-112014-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-112014-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D98511C21EB1 for ; Fri, 22 Mar 2024 20:31:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43F1C7F7EB; Fri, 22 Mar 2024 20:31:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="f9ShoMH8" Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D6C331A60 for ; Fri, 22 Mar 2024 20:31:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711139508; cv=none; b=I/hPUfff/mNSHoYhkGLwA9WoDNplQXaupfj7/+DhsKhjAXxUlshAiUOYEyjQszJhRvA90bD2njyasvzuLDgTF3I/ahZHpaKR8fYlbl3pBHtg/6zWs6qHD1YJjHXAmV9Ci8AullN29Icm5qUKiBdjhVA3xj8b2/nUd9m0VaQi4hI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711139508; c=relaxed/simple; bh=3On0zwm6jM778YElkqeztalhlg0rp2vBVWWMjQCoI1M=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=SEjXLUjAYZDxdWrqRPfi/FL2rFFECJynRVa6VwwKpm4JPKZJSfdPPUQZbsqjgLBRmdOwcO6IJk56t8B4XDbGuT1WDb4F3GonyUq04xBuanQv6IfgqDtLYSv0yB0PGpA/zR8LWAqPbIGcfeN7UPJx82/hVff9OKVos3wb/9oq/V0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=f9ShoMH8; arc=none smtp.client-ip=209.85.218.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-a468226e135so318326566b.0 for ; Fri, 22 Mar 2024 13:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1711139504; x=1711744304; darn=vger.kernel.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=bkEtvYqy1WvJcxiq2A/RIrn4954G/qQAXJYaM8Oh1Rc=; b=f9ShoMH8457G/V9DH6KtgyRoF8sIeWN+T9+R+0ajoU5RslU5A3Bw5yoFIGnBJge9cH QxtYL0N4+xoqQEPDj86x9xPesfm+H0Bm1Qm8z6TGm2HX+5u2u/9UcgQmKpdyrPxe6PX5 dzC1nchDNB9+4HjPMIUgrkd1uIggT/kDppPVvx3oSVfSpyDq2RhFM7s82iekByEQDeXl g00RrpigiXAIGpelyL2mH5MdWazLUDcH67vNHT+uj/Ux2AqeQsnHVFpZ4hKThcHdm951 nwOOidMMUhokuXsDLr6nPnwIv6EKs288MIj5pQ3nG5V9Ea5MtgwJeoBNeqTN2l+REvQ5 Ik8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711139504; x=1711744304; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=bkEtvYqy1WvJcxiq2A/RIrn4954G/qQAXJYaM8Oh1Rc=; b=gfXsVWL9sUTS2dSfq4F4h29XjPFnWUha9tL9jjLfm9tPH8K/a2M+Y7T2cbp0kxWRow WOOOpKOZwp1IKc8z7txFc+mpLJGM6bY5Xx2koC3B/MuJOarzQYpnrETp2HAdhr6X0fZh XPwPh0NcR1sFircjV5i4mzW6lbs1QZjbva64OrHv3Y7WGHoemzDDa+lajntCWwI57oEL 524glTn7UcMgacrD8F6v6q3G3Hr7GjbjUiqfOG2hMdBRzzEotrIlOMwkPQyDo7sLqd6b vtH1KEWNpy3v6tARr0TAnV03P4aCZlbCjbeLm2vUIf2f0Gw5EC0cTUCq7Oxg2qSYZXMV tLHg== X-Gm-Message-State: AOJu0YwC/fMXth1zISCXpU8c/cFGv3G9tCykLcY2RrAHvR/q5oSZQQRK NSNCpftbN2KSiPwEfEBcXwaLYyKKBBSWhDHcwPcG2TSHTFb8bXlRdqNOd+ZfEus= X-Received: by 2002:a17:906:c12:b0:a47:32f7:fe9e with SMTP id s18-20020a1709060c1200b00a4732f7fe9emr528540ejf.37.1711139503934; Fri, 22 Mar 2024 13:31:43 -0700 (PDT) Received: from ?IPv6:2804:5078:98c:e700:58f2:fc97:371f:2? ([2804:5078:98c:e700:58f2:fc97:371f:2]) by smtp.gmail.com with ESMTPSA id lr22-20020a170906fb9600b00a46fc33b479sm191492ejb.13.2024.03.22.13.31.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 13:31:43 -0700 (PDT) Message-ID: <9d4c5c6bd5b7fd0305f9ec26038f4afbea5fc166.camel@suse.com> Subject: Re: [PATCH] selftests: livepatch: Test atomic replace against multiple modules From: Marcos Paulo de Souza To: Joe Lawrence , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Shuah Khan Cc: linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org Date: Fri, 22 Mar 2024 17:31:35 -0300 In-Reply-To: <56bf6323-9e9b-a0e3-f505-d628aac793d4@redhat.com> References: <20240312-lp-selftest-new-test-v1-1-9c843e25e38e@suse.com> <56bf6323-9e9b-a0e3-f505-d628aac793d4@redhat.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.4 (by Flathub.org) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Thu, 2024-03-21 at 10:08 -0400, Joe Lawrence wrote: > On 3/12/24 08:12, Marcos Paulo de Souza wrote: > > This new test checks if a livepatch with replace attribute set > > replaces > > all previously applied livepatches. > >=20 > > Signed-off-by: Marcos Paulo de Souza > > --- > > =C2=A0tools/testing/selftests/livepatch/Makefile=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 3 +- > > =C2=A0.../selftests/livepatch/test-atomic-replace.sh=C2=A0=C2=A0=C2=A0= =C2=A0 | 71 > > ++++++++++++++++++++++ > > =C2=A02 files changed, 73 insertions(+), 1 deletion(-) > >=20 > > diff --git a/tools/testing/selftests/livepatch/Makefile > > b/tools/testing/selftests/livepatch/Makefile > > index 35418a4790be..e92f61208d35 100644 > > --- a/tools/testing/selftests/livepatch/Makefile > > +++ b/tools/testing/selftests/livepatch/Makefile > > @@ -10,7 +10,8 @@ TEST_PROGS :=3D \ > > =C2=A0 test-state.sh \ > > =C2=A0 test-ftrace.sh \ > > =C2=A0 test-sysfs.sh \ > > - test-syscall.sh > > + test-syscall.sh \ > > + test-atomic-replace.sh > > =C2=A0 > > =C2=A0TEST_FILES :=3D settings > > =C2=A0 > > diff --git a/tools/testing/selftests/livepatch/test-atomic- > > replace.sh b/tools/testing/selftests/livepatch/test-atomic- > > replace.sh > > new file mode 100755 > > index 000000000000..09a3dcdcb8de > > --- /dev/null > > +++ b/tools/testing/selftests/livepatch/test-atomic-replace.sh > > @@ -0,0 +1,71 @@ > > +#!/bin/bash > > +# SPDX-License-Identifier: GPL-2.0 > > +# > > +# Copyright (C) 2024 SUSE > > +# Author: Marcos Paulo de Souza > > + > > +. $(dirname $0)/functions.sh > > + > > +MOD_REPLACE=3Dtest_klp_atomic_replace > > + > > +setup_config > > + > > +# - Load three livepatch modules. > > +# - Load one more livepatch with replace being set, and check that > > only one > > +#=C2=A0=C2=A0 livepatch module is being listed. > > + > > +start_test "apply one liveptach to replace multiple livepatches" > > + > > +for mod in test_klp_livepatch test_klp_syscall > > test_klp_callbacks_demo; do > > + load_lp $mod > > +done > > + > > +nmods=3D$(ls /sys/kernel/livepatch | wc -l) > > +if [ $nmods -ne 3 ]; then > > + die "Expecting three modules listed, found $nmods" > > +fi > > + > > +load_lp $MOD_REPLACE replace=3D1 > > + > > +nmods=3D$(ls /sys/kernel/livepatch | wc -l) > > +if [ $nmods -ne 1 ]; then > > + die "Expecting only one moduled listed, found $nmods" > > +fi > > + > > +disable_lp $MOD_REPLACE > > +unload_lp $MOD_REPLACE > > + > > +check_result "% insmod test_modules/test_klp_livepatch.ko > > +livepatch: enabling patch 'test_klp_livepatch' > > +livepatch: 'test_klp_livepatch': initializing patching transition > > +livepatch: 'test_klp_livepatch': starting patching transition > > +livepatch: 'test_klp_livepatch': completing patching transition > > +livepatch: 'test_klp_livepatch': patching complete > > +% insmod test_modules/test_klp_syscall.ko > > +livepatch: enabling patch 'test_klp_syscall' > > +livepatch: 'test_klp_syscall': initializing patching transition > > +livepatch: 'test_klp_syscall': starting patching transition > > +livepatch: 'test_klp_syscall': completing patching transition > > +livepatch: 'test_klp_syscall': patching complete > > +% insmod test_modules/test_klp_callbacks_demo.ko > > +livepatch: enabling patch 'test_klp_callbacks_demo' > > +livepatch: 'test_klp_callbacks_demo': initializing patching > > transition > > +test_klp_callbacks_demo: pre_patch_callback: vmlinux > > +livepatch: 'test_klp_callbacks_demo': starting patching transition > > +livepatch: 'test_klp_callbacks_demo': completing patching > > transition > > +test_klp_callbacks_demo: post_patch_callback: vmlinux > > +livepatch: 'test_klp_callbacks_demo': patching complete > > +% insmod test_modules/test_klp_atomic_replace.ko replace=3D1 > > +livepatch: enabling patch 'test_klp_atomic_replace' > > +livepatch: 'test_klp_atomic_replace': initializing patching > > transition > > +livepatch: 'test_klp_atomic_replace': starting patching transition > > +livepatch: 'test_klp_atomic_replace': completing patching > > transition > > +livepatch: 'test_klp_atomic_replace': patching complete > > +% echo 0 > /sys/kernel/livepatch/test_klp_atomic_replace/enabled > > +livepatch: 'test_klp_atomic_replace': initializing unpatching > > transition > > +livepatch: 'test_klp_atomic_replace': starting unpatching > > transition > > +livepatch: 'test_klp_atomic_replace': completing unpatching > > transition > > +livepatch: 'test_klp_atomic_replace': unpatching complete > > +% rmmod test_klp_atomic_replace" > > + > > +exit 0 > >=20 >=20 > Hi Marcos, >=20 > I'm not against adding a specific atomic replace test, but for a > quick > tl/dr what is the difference between this new test and > test-livepatch.sh's "atomic replace livepatch" test? >=20 > If this one provides better coverage, should we follow up with > removing > the existing one? Hi Joe, thanks for looking at it. To be honest I haven't checked the current use of atomic replace on test-livepatch.sh =3D/ yes, that's mostly the same case, but in mine I load three modules and then load the third one replacing the others, while in the test- livepatch.sh we have only one module that is loaded, replaced, and then we unload the replaced one. Do you see value in extending the test at test-livepatch.sh to load more than one LP moduled and the replace all of them with another one? I believe that it adds more coverage, while keeping the number of tests the same. Thanks! >=20