From: Marcos Paulo de Souza <mpdesouza@suse.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>,
Jiri Kosina <jikos@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
Petr Mladek <pmladek@suse.com>, Shuah Khan <shuah@kernel.org>,
live-patching@vger.kernel.org, linux-kselftest@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/8] selftests: livepatch: test-kprobe: Check if kprobes can work with livepatches
Date: Thu, 19 Mar 2026 11:35:16 -0300 [thread overview]
Message-ID: <c4249fb8b36aba8649e4dcdac022f2d646413756.camel@suse.com> (raw)
In-Reply-To: <abhqRTBtF1hLDmPq@redhat.com>
On Mon, 2026-03-16 at 16:38 -0400, Joe Lawrence wrote:
> On Fri, Mar 13, 2026 at 05:58:34PM -0300, Marcos Paulo de Souza
> wrote:
> > Running the upstream selftests on older kernels can presente some
> > issues
> > regarding features being not present. One of such issues if the
> > missing
> > capability of having both kprobes and livepatches on the same
> > function.
> >
>
> nit picking, but slightly reworded for clarity and spelling:
>
> Running upstream selftests on older kernels can be problematic when
> features or fixes from newer versions are not present. For example,
> older kernels may lack the capability to support kprobes and
> livepatches
> on the same function simultaneously.
Much better, I'll pick your description for v2.
>
> > The support was introduced in commit 0bc11ed5ab60c
> > ("kprobes: Allow kprobes coexist with livepatch"), which means that
> > older
> > kernels may lack this change.
> >
> > The lack of this feature can be checked when a kprobe without a
> > post_handler is loaded and checking that the enabled_function's
> > file
> > shows the flag "I". A kernel with the proper support for kprobes
> > and
> > livepatches would presente the flag only when a post_handler is
>
> nit: s/presente/present
Ok.
>
> > registered.
> >
> > No functional changes.
> >
> > Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
> > ---
> > tools/testing/selftests/livepatch/test-kprobe.sh | 52
> > ++++++++++++++----------
> > 1 file changed, 31 insertions(+), 21 deletions(-)
> >
> > diff --git a/tools/testing/selftests/livepatch/test-kprobe.sh
> > b/tools/testing/selftests/livepatch/test-kprobe.sh
> > index cdf31d0e51955..44cd16156dbd4 100755
> > --- a/tools/testing/selftests/livepatch/test-kprobe.sh
> > +++ b/tools/testing/selftests/livepatch/test-kprobe.sh
> > @@ -16,30 +16,19 @@ setup_config
> > # when it uses a post_handler since only one IPMODIFY maybe be
> > registered
> > # to any given function at a time.
> >
> > -start_test "livepatch interaction with kprobed function with
> > post_handler"
> > -
> > -echo 1 > "$SYSFS_KPROBES_DIR/enabled"
> > -
> > -load_mod $MOD_KPROBE has_post_handler=1
> > -load_failing_mod $MOD_LIVEPATCH
> > -unload_mod $MOD_KPROBE
> > -
> > -check_result "% insmod test_modules/test_klp_kprobe.ko
> > has_post_handler=1
> > -% insmod test_modules/$MOD_LIVEPATCH.ko
> > -livepatch: enabling patch '$MOD_LIVEPATCH'
> > -livepatch: '$MOD_LIVEPATCH': initializing patching transition
> > -livepatch: failed to register ftrace handler for function
> > 'cmdline_proc_show' (-16)
> > -livepatch: failed to patch object 'vmlinux'
> > -livepatch: failed to enable patch '$MOD_LIVEPATCH'
> > -livepatch: '$MOD_LIVEPATCH': canceling patching transition, going
> > to unpatch
> > -livepatch: '$MOD_LIVEPATCH': completing unpatching transition
> > -livepatch: '$MOD_LIVEPATCH': unpatching complete
> > -insmod: ERROR: could not insert module
> > test_modules/$MOD_LIVEPATCH.ko: Device or resource busy
> > -% rmmod test_klp_kprobe"
> > -
> > start_test "livepatch interaction with kprobed function without
> > post_handler"
> >
> > load_mod $MOD_KPROBE has_post_handler=0
> > +
> > +# Check if commit 0bc11ed5ab60c ("kprobes: Allow kprobes coexist
> > with livepatch")
> > +# is missing, meaning that livepatches and kprobes can't be used
> > together.
> > +# When the commit is missing, kprobes always set IPMODIFY (the I
> > flag), even
> > +# when the post handler is missing.
> > +if grep --quiet ") R I"
> > "$SYSFS_DEBUG_DIR/tracing/enabled_functions"; then
>
> Will flags R I always be in this order?
seq_printf(m, " (%ld)%s%s%s%s%s",
ftrace_rec_count(rec),
rec->flags & FTRACE_FL_REGS ? " R" : " ",
rec->flags & FTRACE_FL_IPMODIFY ? " I" : "
",
So this is safe. I'll add a comment in the patch to explain why this is
safe too. Thanks for the comment!
>
> --
> Joe
next prev parent reply other threads:[~2026-03-19 14:35 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 20:58 [PATCH 0/8] kselftests: livepatch: Adapt tests to be executed on 4.12 kernels Marcos Paulo de Souza
2026-03-13 20:58 ` [PATCH 1/8] selftests: livepatch: test-syscall: Check for ARCH_HAS_SYSCALL_WRAPPER Marcos Paulo de Souza
2026-03-16 20:12 ` Joe Lawrence
2026-03-19 12:54 ` Miroslav Benes
2026-03-19 14:11 ` Marcos Paulo de Souza
2026-03-20 10:45 ` Miroslav Benes
2026-03-27 13:24 ` Marcos Paulo de Souza
2026-03-27 13:16 ` Marcos Paulo de Souza
2026-03-13 20:58 ` [PATCH 2/8] selftests: livepatch: test-kprobe: Replace true/false mod param by 1/0 Marcos Paulo de Souza
2026-03-19 13:03 ` Miroslav Benes
2026-03-19 14:16 ` Marcos Paulo de Souza
2026-03-20 11:18 ` Miroslav Benes
2026-03-13 20:58 ` [PATCH 3/8] selftests: livepatch: test-kprobe: Check if kprobes can work with livepatches Marcos Paulo de Souza
2026-03-16 20:38 ` Joe Lawrence
2026-03-19 14:35 ` Marcos Paulo de Souza [this message]
2026-03-20 11:33 ` Petr Mladek
2026-03-27 13:43 ` Marcos Paulo de Souza
2026-03-13 20:58 ` [PATCH 4/8] selftests: livepatch: functions: Introduce check_sysfs_exists Marcos Paulo de Souza
2026-03-16 20:47 ` Joe Lawrence
2026-03-13 20:58 ` [PATCH 5/8] selftests: livepatch: sysfs: Split tests of replace attribute Marcos Paulo de Souza
2026-03-20 13:03 ` Miroslav Benes
2026-03-20 13:12 ` Petr Mladek
2026-03-13 20:58 ` [PATCH 6/8] selftests: livepatch: sysfs: Split tests of stack_order attribute Marcos Paulo de Souza
2026-03-13 20:58 ` [PATCH 7/8] selftests: livepatch: sysfs: Split tests of patched attribute Marcos Paulo de Souza
2026-03-13 20:58 ` [PATCH 8/8] selftests: livepatch: functions.sh: Extend check for taint flag kernel message Marcos Paulo de Souza
2026-03-20 13:04 ` Miroslav Benes
2026-03-20 13:26 ` Petr Mladek
2026-03-20 13:41 ` Marcos Paulo de Souza
2026-03-20 13:31 ` [PATCH 0/8] kselftests: livepatch: Adapt tests to be executed on 4.12 kernels Petr Mladek
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=c4249fb8b36aba8649e4dcdac022f2d646413756.camel@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=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