live-patching.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE
@ 2025-03-18 18:15 Song Liu
  2025-03-21 13:16 ` Miroslav Benes
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Song Liu @ 2025-03-18 18:15 UTC (permalink / raw)
  To: live-patching
  Cc: joe.lawrence, jpoimboe, kernel-team, song, jikos, mbenes, pmladek

CONFIG_KPROBES_ON_FTRACE is required for test-kprobe. Skip test-kprobe
when CONFIG_KPROBES_ON_FTRACE is not set. Since some kernel may not have
/proc/config.gz, grep for kprobe_ftrace_ops from /proc/kallsyms to check
whether CONFIG_KPROBES_ON_FTRACE is enabled.

Signed-off-by: Song Liu <song@kernel.org>

---

Changes v1 => v2:
1. Grep for kprobe_ftrace_ops in /proc/kallsyms, as some systems may not
   have /proc/config.gz
---
 tools/testing/selftests/livepatch/test-kprobe.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/livepatch/test-kprobe.sh b/tools/testing/selftests/livepatch/test-kprobe.sh
index 115065156016..e514391c5454 100755
--- a/tools/testing/selftests/livepatch/test-kprobe.sh
+++ b/tools/testing/selftests/livepatch/test-kprobe.sh
@@ -5,6 +5,8 @@
 
 . $(dirname $0)/functions.sh
 
+grep kprobe_ftrace_ops /proc/kallsyms || skip "test-kprobe requires CONFIG_KPROBES_ON_FTRACE"
+
 MOD_LIVEPATCH=test_klp_livepatch
 MOD_KPROBE=test_klp_kprobe
 
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE
  2025-03-18 18:15 [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE Song Liu
@ 2025-03-21 13:16 ` Miroslav Benes
  2025-03-24 17:57 ` Joe Lawrence
  2025-03-25 12:46 ` Petr Mladek
  2 siblings, 0 replies; 4+ messages in thread
From: Miroslav Benes @ 2025-03-21 13:16 UTC (permalink / raw)
  To: Song Liu; +Cc: live-patching, joe.lawrence, jpoimboe, kernel-team, jikos,
	pmladek

On Tue, 18 Mar 2025, Song Liu wrote:

> CONFIG_KPROBES_ON_FTRACE is required for test-kprobe. Skip test-kprobe
> when CONFIG_KPROBES_ON_FTRACE is not set. Since some kernel may not have
> /proc/config.gz, grep for kprobe_ftrace_ops from /proc/kallsyms to check
> whether CONFIG_KPROBES_ON_FTRACE is enabled.
> 
> Signed-off-by: Song Liu <song@kernel.org>

Acked-by: Miroslav Benes <mbenes@suse.cz>

M

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE
  2025-03-18 18:15 [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE Song Liu
  2025-03-21 13:16 ` Miroslav Benes
@ 2025-03-24 17:57 ` Joe Lawrence
  2025-03-25 12:46 ` Petr Mladek
  2 siblings, 0 replies; 4+ messages in thread
From: Joe Lawrence @ 2025-03-24 17:57 UTC (permalink / raw)
  To: Song Liu; +Cc: live-patching, jpoimboe, kernel-team, jikos, mbenes, pmladek

On Tue, Mar 18, 2025 at 11:15:18AM -0700, Song Liu wrote:
> CONFIG_KPROBES_ON_FTRACE is required for test-kprobe. Skip test-kprobe
> when CONFIG_KPROBES_ON_FTRACE is not set. Since some kernel may not have
> /proc/config.gz, grep for kprobe_ftrace_ops from /proc/kallsyms to check
> whether CONFIG_KPROBES_ON_FTRACE is enabled.
> 
> Signed-off-by: Song Liu <song@kernel.org>
> 
> ---
> 
> Changes v1 => v2:
> 1. Grep for kprobe_ftrace_ops in /proc/kallsyms, as some systems may not
>    have /proc/config.gz
> ---
>  tools/testing/selftests/livepatch/test-kprobe.sh | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tools/testing/selftests/livepatch/test-kprobe.sh b/tools/testing/selftests/livepatch/test-kprobe.sh
> index 115065156016..e514391c5454 100755
> --- a/tools/testing/selftests/livepatch/test-kprobe.sh
> +++ b/tools/testing/selftests/livepatch/test-kprobe.sh
> @@ -5,6 +5,8 @@
>  
>  . $(dirname $0)/functions.sh
>  
> +grep kprobe_ftrace_ops /proc/kallsyms || skip "test-kprobe requires CONFIG_KPROBES_ON_FTRACE"
> +
>  MOD_LIVEPATCH=test_klp_livepatch
>  MOD_KPROBE=test_klp_kprobe
>  

Super minor nit (maybe Petr can tweak on merging): this grep (without
-q) will dump the resulting search lines to the terminal while all other
existing tests only show "TEST: description .... ok" lines they pass.

Acked-by: Joe Lawrence <joe.lawrence@redhat.com>

-- Joe


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE
  2025-03-18 18:15 [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE Song Liu
  2025-03-21 13:16 ` Miroslav Benes
  2025-03-24 17:57 ` Joe Lawrence
@ 2025-03-25 12:46 ` Petr Mladek
  2 siblings, 0 replies; 4+ messages in thread
From: Petr Mladek @ 2025-03-25 12:46 UTC (permalink / raw)
  To: Song Liu
  Cc: live-patching, joe.lawrence, jpoimboe, kernel-team, jikos, mbenes

On Tue 2025-03-18 11:15:18, Song Liu wrote:
> CONFIG_KPROBES_ON_FTRACE is required for test-kprobe. Skip test-kprobe
> when CONFIG_KPROBES_ON_FTRACE is not set. Since some kernel may not have
> /proc/config.gz, grep for kprobe_ftrace_ops from /proc/kallsyms to check
> whether CONFIG_KPROBES_ON_FTRACE is enabled.
> 
> Signed-off-by: Song Liu <song@kernel.org>

JFYI, I have added the -q option and pushed the patch into
livepatching.git, branch for-6.15/trivial, see
https://web.git.kernel.org/pub/scm/linux/kernel/git/livepatching/livepatching.git/commit/?h=for-6.15/trivial

IMHO, it is trivial and it is a selftest so it still go into 6.15.
I am going to send the pull request on Thursday or so.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-03-25 12:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-18 18:15 [PATCH v2] selftest/livepatch: Only run test-kprobe with CONFIG_KPROBES_ON_FTRACE Song Liu
2025-03-21 13:16 ` Miroslav Benes
2025-03-24 17:57 ` Joe Lawrence
2025-03-25 12:46 ` Petr Mladek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).