mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Marcos Paulo de Souza <mpdesouza@suse.com>
To: Josh Poimboeuf <jpoimboe@kernel.org>,
	Jiri Kosina <jikos@kernel.org>,  Miroslav Benes <mbenes@suse.cz>,
	Petr Mladek <pmladek@suse.com>,
	 Joe Lawrence <joe.lawrence@redhat.com>,
	Shuah Khan <shuah@kernel.org>
Cc: live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
	 linux-kernel@vger.kernel.org,
	Marcos Paulo de Souza <mpdesouza@suse.com>,
	 marcos@mpdesouza.com
Subject: [PATCH 0/4] selftests: livepatch: Support 4.12 kernels
Date: Sun, 24 May 2026 20:50:29 -0300	[thread overview]
Message-ID: <20260524-livepatch-unload-on-fail-v1-0-7465de7f741d@suse.com> (raw)

One issue that exists since the inception of the livepatch selftests is
the capability of recovering from a failed test: the tested livepatch
modules were kept loaded, interfering with the next tests. The first two
commits introduce a simple mechanism that tracks all loaded modules,
and if the test is aborted, the trap function will disable/unload
the remaining modules. With these changes the test
"livepatch interaction with kprobed function without post_handler" fails
on 4.12 kernels (lacking the feature to have a kprobe a livepatches
to be used alongside), but the loaded modules are unloaded, not
affecting the next tests.

The other patches adapt the test_klp_mod_target.c file to use
module_param_cb and kernel_param_ops structures to test livepatching
of functions in modules. This was done to allow the test to be compiled
on 4.12 kernels. Older kernels lacks proc_create_single function, and
to adapt the code for older versions would require ifdefs, which are
not desirable.

I tested these changes using the current upstream kernel and kernel
from SLE 12-SP5 (kernel 4.12). The test-kprobe.sh test fails on 4.12 due
to the missing capability of livepatch and kprobes to be used together.
The result is that now selftests is able to unload the modules loaded,
and continue with the next tests. For the livepatch target test, it works
the same for 4.12 and current upstream.

Please test and review!

Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
---
Marcos Paulo de Souza (4):
      selftests: livepatch: Introduce _remove_mod function
      selftests: livepatch: Remove leftover modules when a testcase fails
      selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels
      selftests: livepatch: Add information about minimum kernel support

 tools/testing/selftests/livepatch/README           |  3 ++
 tools/testing/selftests/livepatch/functions.sh     | 35 ++++++++++++++++++++--
 .../testing/selftests/livepatch/test-livepatch.sh  | 23 +++++++-------
 .../livepatch/test_modules/test_klp_mod_patch.c    | 11 ++++---
 .../livepatch/test_modules/test_klp_mod_target.c   | 22 +++++++-------
 5 files changed, 62 insertions(+), 32 deletions(-)
---
base-commit: 8f7168335cb2e438668c5d94eea76621c9a10edd
change-id: 20260506-livepatch-unload-on-fail-56d30a4e45ca

Best regards,
--  
Marcos Paulo de Souza <mpdesouza@suse.com>


             reply	other threads:[~2026-05-24 23:50 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-24 23:50 Marcos Paulo de Souza [this message]
2026-05-24 23:50 ` [PATCH 1/4] selftests: livepatch: Introduce _remove_mod function Marcos Paulo de Souza
2026-05-24 23:59   ` sashiko-bot
2026-05-25 11:49     ` Marcos Paulo de Souza
2026-06-05 13:44       ` Petr Mladek
2026-05-24 23:50 ` [PATCH 2/4] selftests: livepatch: Remove leftover modules when a testcase fails Marcos Paulo de Souza
2026-05-25  0:06   ` sashiko-bot
2026-06-05 14:15     ` Petr Mladek
2026-06-05 13:59   ` Petr Mladek
2026-05-24 23:50 ` [PATCH 3/4] selftests: livepatch: Adapt mod_target module to pass on 4.12 kernels Marcos Paulo de Souza
2026-05-25  0:24   ` sashiko-bot
2026-06-05 14:05     ` Marcos Paulo de Souza
2026-06-05 14:39       ` Petr Mladek
2026-06-05 14:36   ` Petr Mladek
2026-05-24 23:50 ` [PATCH 4/4] selftests: livepatch: Add information about minimum kernel support Marcos Paulo de Souza
2026-05-25  0:29   ` sashiko-bot
2026-06-05 15:14   ` Petr Mladek
2026-06-19 12:52     ` Miroslav Benes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260524-livepatch-unload-on-fail-v1-0-7465de7f741d@suse.com \
    --to=mpdesouza@suse.com \
    --cc=jikos@kernel.org \
    --cc=joe.lawrence@redhat.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=marcos@mpdesouza.com \
    --cc=mbenes@suse.cz \
    --cc=pmladek@suse.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®