Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp105168rdb; Thu, 21 Dec 2023 04:17:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IEkzJ50IcgrB3sZAeWrnHaUezLFq12r+LT3SnjBO+2ps7AHmXI7XY1fjgKKkYRjurEFmgVk X-Received: by 2002:a50:a455:0:b0:552:3044:1df9 with SMTP id v21-20020a50a455000000b0055230441df9mr6839903edb.67.1703161050983; Thu, 21 Dec 2023 04:17:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703161050; cv=none; d=google.com; s=arc-20160816; b=uDH5g1+MVnz/BvDhVcn1BesTYJ49G1L69nlYzRd2suh15Ma4MbsY7AUFIVyNUwR6lo STq8Jh7AT/5KG+Ok2Bw//Tx8+H1eHN51l0hcEH25VKTHJ1Cb7jVF/rdxRi98tEnIwiyP gJ7sJIrWZkxbzCGhl43K9SnFLec7Who87NDeIKX9Ds/FC2DOkXEi8ywtP7E8MCGJAgmx J4O1mPW6Im2N/aDL/NmRYSRzVvlbPARJMfgbKH+QhRkx4FtLQg8Z2JJo0ik+q2X8wsMa ROg1AkunGFK1uEl8620OhkT/l3Y3ZVo1YbU1CkT7RhrWyxynCuUWNXMWtx7AcPNza+GR VzRQ== ARC-Message-Signature: i=1; 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=wo4F4JANDOClYN3jxQcqNRyTGhNp1nyKO/PKQRBOOYU=; fh=wrDwrGPjyI6/GM7n4U2urfu8674Vh7kz+FJNuwAamOY=; b=eq48TL7UzvAkitOtCNp8n8Jhc2joqgbHKgV3lzWhrTr+yXSAtIpIU3Vkl1G17Yn+/M DZk2fElIlbY4ljkk+3bHnCwf4oOAfwFPav3yiW0rKnrauZ0pnI59yRLRmtjoNBacBs2Z O3ZYdBVyw0iGwaZuNZePgvjGISAQjfItldhcLzvpk40FBpj4oeluSP4Maq9WFChygqRW 56RO3phozLarkLddVxK6xyL5BNfnVNZD4CI22Vwv2fhFoJD52aeN392tMleylM6e5n6M NZOIaSg/Rqc/Lf5KhhnzefAoXnzMwpBAoJpt23Bm3AjQM1kRXF3jtOTlx16tiNYT1t/N U4hg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=b2hXv4Fa; spf=pass (google.com: domain of linux-kernel+bounces-8321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8321-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id v2-20020a056402348200b005519bcc5894si833221edc.591.2023.12.21.04.17.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 04:17:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-8321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=google header.b=b2hXv4Fa; spf=pass (google.com: domain of linux-kernel+bounces-8321-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-8321-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 52ABB1F23C10 for ; Thu, 21 Dec 2023 12:17:30 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3BE2E6EB61; Thu, 21 Dec 2023 12:17:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="b2hXv4Fa" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 2712A6E59D for ; Thu, 21 Dec 2023 12:17:16 +0000 (UTC) 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-wm1-f49.google.com with SMTP id 5b1f17b1804b1-40d2764c0f2so8696995e9.2 for ; Thu, 21 Dec 2023 04:17:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1703161035; x=1703765835; 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=wo4F4JANDOClYN3jxQcqNRyTGhNp1nyKO/PKQRBOOYU=; b=b2hXv4FadH3SMVjwstOXXV9hqWfCEQEkIAG9p9uCUHspvvLECNXeI6Shq/25ftaElw LVbMmNxz5DEzQvw2xDVnlb0C+IqOAjlJtiLIVeZxcY6ydOsWqXlFsg3rGBNIqN+9FCfY gdoIq1EXuwZAT8DYfTIMqje087V/5fg3ZbrAADs+rRVxArl/++NI6xJiLW6Q8zXmqGEi dqFqfHydBHvAVdjQsZUg/XmfHaH/tMU1XDBBuoPH1YAI5cQ+jpJMJbsBajj1CzZeBbv8 SNVL+OvcIRD8o0M93z3yw6kBzRkIZb8+fO9xZGGJNDxQO25V4q0zWhV0g9K2xBg+W7nu zrww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703161035; x=1703765835; 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=wo4F4JANDOClYN3jxQcqNRyTGhNp1nyKO/PKQRBOOYU=; b=EDkL+yvaq7IJ3PMIjbSUR0DIDdj0HwXQJRcmQyjp/VNM/9/P1IzYMjZZZXBGtvEKDx /JQANblbkGU3KztVgh5QMSbqOa4xEJcg+XpiPCiEgY3dPaFUAmnIYhfIBVUs/0G69CUa InZWAaG9xqL9dEejQ/mDBoRj8wq2Ulx5wxtfzQl0e9TJsVi8g5H5AGIk+jeS21PHb6na 4ExWxeVUo2/eywDgMdqLXF5WFe5Q9Pl8sWtpT4FPyGBtXey1+aosi8Uzz6zXaovGUHM0 B5J2737bh3x6FYm8TaEJ55sS2mONGFfcHAwjLhMVwir8SuSBAWMzKmqTLqWF3s0hi3Er zxzg== X-Gm-Message-State: AOJu0YymtI/nGnOshlfAL+Iy63Cf/itsacrEtzF8rWPhQBo9ofk4M7PT 3gra5bYUVFVXHE8nRSWXiErT7w== X-Received: by 2002:a7b:ce87:0:b0:40d:38df:5802 with SMTP id q7-20020a7bce87000000b0040d38df5802mr705115wmj.165.1703161035199; Thu, 21 Dec 2023 04:17:15 -0800 (PST) Received: from ?IPv6:2804:30c:1668:b300:8fcd:588d:fb77:ed04? ([2804:30c:1668:b300:8fcd:588d:fb77:ed04]) by smtp.gmail.com with ESMTPSA id l15-20020a5d560f000000b0033609584b9dsm1909827wrv.74.2023.12.21.04.17.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Dec 2023 04:17:14 -0800 (PST) Message-ID: <55b717dba239f3bedf0da7e25925e390a63459f5.camel@suse.com> Subject: Re: [PATCH RESEND v4 0/3] livepatch: Move modules to selftests and add a new test From: Marcos Paulo de Souza To: Shuah Khan , Jonathan Corbet , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Josh Poimboeuf , Jiri Kosina , Miroslav Benes , Petr Mladek , Joe Lawrence Cc: linux-kselftest@vger.kernel.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org, live-patching@vger.kernel.org Date: Thu, 21 Dec 2023 09:17:04 -0300 In-Reply-To: <20231220-send-lp-kselftests-v4-0-3458ec1b1a38@suse.com> References: <20231220-send-lp-kselftests-v4-0-3458ec1b1a38@suse.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.50.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 On Wed, 2023-12-20 at 13:53 -0300, Marcos Paulo de Souza wrote: > Changes in v4: > * Documented how to compile the livepatch selftests without running > the > =C2=A0 tests (Joe) > * Removed the mention to lib/livepatch on MAINTAINERS file, reported > by > =C2=A0 checkpatch. >=20 To clarify: this is not a resend, this is the v4 that people were waiting for. I made a mistake with b4 tool, that first I sent the email just to myself, for testing, and it bumped the version to v5, but I asked it to "resend" the v4, but it ended up adding the "RESEND" to the series. Please review this patchset and ignore the RESEND word. Thanks to Petr Mladek for spotting my mistake. Marcos > Changes in v3: > * Rebased on top of v6.6-rc5 > * The commits messages were improved (Thanks Petr!) > * Created TEST_GEN_MODS_DIR variable to point to a directly that > contains kernel > =C2=A0 modules, and adapt selftests to build it before running the test. > * Moved test_klp-call_getpid out of test_programs, since the gen_tar > =C2=A0 would just copy the generated test programs to the livepatches dir= , > =C2=A0 and so scripts relying on test_programs/test_klp-call_getpid will > fail. > * Added a module_param for klp_pids, describing it's usage. > * Simplified the call_getpid program to ignore the return of getpid > syscall, > =C2=A0 since we only want to make sure the process transitions correctly > to the > =C2=A0 patched stated > * The test-syscall.sh not prints a log message showing the number of > remaining > =C2=A0 processes to transition into to livepatched state, and check_outpu= t > expects it > =C2=A0 to be 0. > * Added MODULE_AUTHOR and MODULE_DESCRIPTION to test_klp_syscall.c >=20 > - Link to v3: > https://lore.kernel.org/r/20231031-send-lp-kselftests-v3-0-2b1655c2605f@s= use.com > - Link to v2: > https://lore.kernel.org/linux-kselftest/20220630141226.2802-1-mpdesouza@s= use.com/ >=20 > This patchset moves the current kernel testing livepatch modules from > lib/livepatches to tools/testing/selftest/livepatch/test_modules, and > compiles > them as out-of-tree modules before testing. >=20 > There is also a new test being added. This new test exercises > multiple processes > calling a syscall, while a livepatch patched the syscall. >=20 > Why this move is an improvement: > * The modules are now compiled as out-of-tree modules against the > current > =C2=A0 running kernel, making them capable of being tested on different > systems with > =C2=A0 newer or older kernels. > * Such approach now needs kernel-devel package to be installed, since > they are > =C2=A0 out-of-tree modules. These can be generated by running "make rpm- > pkg" in the > =C2=A0 kernel source. >=20 > What needs to be solved: > * Currently gen_tar only packages the resulting binaries of the > tests, and not > =C2=A0 the sources. For the current approach, the newly added modules > would be > =C2=A0 compiled and then packaged. It works when testing on a system with > the same > =C2=A0 kernel version. But it will fail when running on a machine with > different kernel > =C2=A0 version, since module was compiled against the kernel currently > running. >=20 > =C2=A0 This is not a new problem, just aligning the expectations. For the > current > =C2=A0 approach to be truly system agnostic gen_tar would need to include > the module > =C2=A0 and program sources to be compiled in the target systems. >=20 > Thanks in advance! > =C2=A0 Marcos >=20 > Signed-off-by: Marcos Paulo de Souza > --- > Marcos Paulo de Souza (3): > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 kselftests: lib.mk: Add TEST_GEN_MODS_DIR = variable > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 livepatch: Move tests from lib/livepatch t= o selftests/livepatch > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 selftests: livepatch: Test livepatching a = heavily called > syscall >=20 > =C2=A0Documentation/dev-tools/kselftest.rst=C2=A0=C2=A0=C2=A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2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 2 - > =C2=A0lib/livepatch/Makefile=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 14 --- > =C2=A0tools/testing/selftests/lib.mk=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 |=C2=A0 20 +++- > =C2=A0tools/testing/selftests/livepatch/Makefile=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 5 +- > =C2=A0tools/testing/selftests/livepatch/README=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0 25 +++-- > =C2=A0tools/testing/selftests/livepatch/config=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 1 - > =C2=A0tools/testing/selftests/livepatch/functions.sh=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0 34 +++--- > =C2=A0.../testing/selftests/livepatch/test-callbacks.sh=C2=A0 |=C2=A0 50 = ++++----- > =C2=A0tools/testing/selftests/livepatch/test-ftrace.sh=C2=A0=C2=A0 |=C2= =A0=C2=A0 6 +- > =C2=A0.../testing/selftests/livepatch/test-livepatch.sh=C2=A0 |=C2=A0 10 = +- > =C2=A0.../selftests/livepatch/test-shadow-vars.sh=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 2 +- > =C2=A0tools/testing/selftests/livepatch/test-state.sh=C2=A0=C2=A0=C2=A0 |= =C2=A0 18 ++-- > =C2=A0tools/testing/selftests/livepatch/test-syscall.sh=C2=A0 |=C2=A0 53 = ++++++++++ > =C2=A0tools/testing/selftests/livepatch/test-sysfs.sh=C2=A0=C2=A0=C2=A0 |= =C2=A0=C2=A0 6 +- > =C2=A0.../selftests/livepatch/test_klp-call_getpid.c=C2=A0=C2=A0=C2=A0=C2= =A0 |=C2=A0 44 ++++++++ > =C2=A0.../selftests/livepatch/test_modules/Makefile=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 |=C2=A0 20 ++++ > =C2=A0.../test_modules}/test_klp_atomic_replace.c=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../test_modules}/test_klp_callbacks_busy.c=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../test_modules}/test_klp_callbacks_demo.c=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../test_modules}/test_klp_callbacks_demo2.c=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../test_modules}/test_klp_callbacks_mod.c=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../livepatch/test_modules}/test_klp_livepatch.c=C2=A0=C2=A0 |=C2= =A0=C2=A0 0 > =C2=A0.../livepatch/test_modules}/test_klp_shadow_vars.c |=C2=A0=C2=A0 0 > =C2=A0.../livepatch/test_modules}/test_klp_state.c=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../livepatch/test_modules}/test_klp_state2.c=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../livepatch/test_modules}/test_klp_state3.c=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 |=C2=A0=C2=A0 0 > =C2=A0.../livepatch/test_modules/test_klp_syscall.c=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 | 116 > +++++++++++++++++++++ > =C2=A032 files changed, 334 insertions(+), 121 deletions(-) > --- > base-commit: 206ed72d6b33f53b2a8bf043f54ed6734121d26b > change-id: 20231031-send-lp-kselftests-4c917dcd4565 >=20 > Best regards,