mbox series

[v5,0/3] selftests: livepatch: test livepatching a kprobed function

Message ID 20241017200132.21946-1-mvetter@suse.com (mailing list archive)
Headers show
Series selftests: livepatch: test livepatching a kprobed function | expand

Message

Michael Vetter Oct. 17, 2024, 8:01 p.m. UTC
Thanks for all the reviews.

V5:
Replace /sys/kernel/livepatch also in other/already existing tests.
Improve commit message of 3rd patch.

V4:
Use variable for /sys/kernel/debug.
Be consistent with "" around variables.
Fix path in commit message to /sys/kernel/debug/kprobes/enabled.

V3:
Save and restore kprobe state also when test fails, by integrating it
into setup_config() and cleanup().
Rename SYSFS variables in a more logical way.
Sort test modules in alphabetical order.
Rename module description.

V2:
Save and restore kprobe state.

Michael Vetter (3):
  selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR
  selftests: livepatch: save and restore kprobe state
  selftests: livepatch: test livepatching a kprobed function

 tools/testing/selftests/livepatch/Makefile    |  3 +-
 .../testing/selftests/livepatch/functions.sh  | 29 +++++----
 .../selftests/livepatch/test-callbacks.sh     | 24 +++----
 .../selftests/livepatch/test-ftrace.sh        |  2 +-
 .../selftests/livepatch/test-kprobe.sh        | 62 +++++++++++++++++++
 .../selftests/livepatch/test-livepatch.sh     | 12 ++--
 .../testing/selftests/livepatch/test-state.sh |  8 +--
 .../selftests/livepatch/test-syscall.sh       |  2 +-
 .../testing/selftests/livepatch/test-sysfs.sh |  8 +--
 .../selftests/livepatch/test_modules/Makefile |  3 +-
 .../livepatch/test_modules/test_klp_kprobe.c  | 38 ++++++++++++
 11 files changed, 150 insertions(+), 41 deletions(-)
 create mode 100755 tools/testing/selftests/livepatch/test-kprobe.sh
 create mode 100644 tools/testing/selftests/livepatch/test_modules/test_klp_kprobe.c

Comments

Joe Lawrence Oct. 21, 2024, 6:57 p.m. UTC | #1
On 10/17/24 16:01, Michael Vetter wrote:
> Thanks for all the reviews.
> 
> V5:
> Replace /sys/kernel/livepatch also in other/already existing tests.
> Improve commit message of 3rd patch.
> 
> V4:
> Use variable for /sys/kernel/debug.
> Be consistent with "" around variables.
> Fix path in commit message to /sys/kernel/debug/kprobes/enabled.
> 
> V3:
> Save and restore kprobe state also when test fails, by integrating it
> into setup_config() and cleanup().
> Rename SYSFS variables in a more logical way.
> Sort test modules in alphabetical order.
> Rename module description.
> 
> V2:
> Save and restore kprobe state.
> 
> Michael Vetter (3):
>   selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR
>   selftests: livepatch: save and restore kprobe state
>   selftests: livepatch: test livepatching a kprobed function
> 
>  tools/testing/selftests/livepatch/Makefile    |  3 +-
>  .../testing/selftests/livepatch/functions.sh  | 29 +++++----
>  .../selftests/livepatch/test-callbacks.sh     | 24 +++----
>  .../selftests/livepatch/test-ftrace.sh        |  2 +-
>  .../selftests/livepatch/test-kprobe.sh        | 62 +++++++++++++++++++
>  .../selftests/livepatch/test-livepatch.sh     | 12 ++--
>  .../testing/selftests/livepatch/test-state.sh |  8 +--
>  .../selftests/livepatch/test-syscall.sh       |  2 +-
>  .../testing/selftests/livepatch/test-sysfs.sh |  8 +--
>  .../selftests/livepatch/test_modules/Makefile |  3 +-
>  .../livepatch/test_modules/test_klp_kprobe.c  | 38 ++++++++++++
>  11 files changed, 150 insertions(+), 41 deletions(-)
>  create mode 100755 tools/testing/selftests/livepatch/test-kprobe.sh
>  create mode 100644 tools/testing/selftests/livepatch/test_modules/test_klp_kprobe.c
> 

With the small syntax error fixed in unload_lp(),

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

Thanks, Michael, this is a good test to add to the suite.
Marcos Paulo de Souza Oct. 21, 2024, 8:16 p.m. UTC | #2
On Thu, 2024-10-17 at 22:01 +0200, Michael Vetter wrote:
> Thanks for all the reviews.
> 
> V5:
> Replace /sys/kernel/livepatch also in other/already existing tests.
> Improve commit message of 3rd patch.
> 
> V4:
> Use variable for /sys/kernel/debug.
> Be consistent with "" around variables.
> Fix path in commit message to /sys/kernel/debug/kprobes/enabled.
> 
> V3:
> Save and restore kprobe state also when test fails, by integrating it
> into setup_config() and cleanup().
> Rename SYSFS variables in a more logical way.
> Sort test modules in alphabetical order.
> Rename module description.
> 
> V2:
> Save and restore kprobe state.

With the syntax error pointed out by Joe resolved, you can add:

Tested-by: Marcos Paulo de Souza <mpdesouza@suse.com>
Reviewed-by: Marcos Paulo de Souza <mpdesouza@suse.com>

> 
> Michael Vetter (3):
>   selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR
>   selftests: livepatch: save and restore kprobe state
>   selftests: livepatch: test livepatching a kprobed function
> 
>  tools/testing/selftests/livepatch/Makefile    |  3 +-
>  .../testing/selftests/livepatch/functions.sh  | 29 +++++----
>  .../selftests/livepatch/test-callbacks.sh     | 24 +++----
>  .../selftests/livepatch/test-ftrace.sh        |  2 +-
>  .../selftests/livepatch/test-kprobe.sh        | 62
> +++++++++++++++++++
>  .../selftests/livepatch/test-livepatch.sh     | 12 ++--
>  .../testing/selftests/livepatch/test-state.sh |  8 +--
>  .../selftests/livepatch/test-syscall.sh       |  2 +-
>  .../testing/selftests/livepatch/test-sysfs.sh |  8 +--
>  .../selftests/livepatch/test_modules/Makefile |  3 +-
>  .../livepatch/test_modules/test_klp_kprobe.c  | 38 ++++++++++++
>  11 files changed, 150 insertions(+), 41 deletions(-)
>  create mode 100755 tools/testing/selftests/livepatch/test-kprobe.sh
>  create mode 100644
> tools/testing/selftests/livepatch/test_modules/test_klp_kprobe.c
>
Petr Mladek Oct. 22, 2024, 9 a.m. UTC | #3
On Thu 2024-10-17 22:01:29, Michael Vetter wrote:
> Thanks for all the reviews.
> 
> V5:
> Replace /sys/kernel/livepatch also in other/already existing tests.
> Improve commit message of 3rd patch.

With the syntax error fixed by Joe:

Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>

Note: I could fix the syntax error when pushing the patchset.
      There is no need to send v6 if this is the only problem.

Best Regards,
Petr
Petr Mladek Oct. 22, 2024, 3:26 p.m. UTC | #4
On Thu 2024-10-17 22:01:29, Michael Vetter wrote:
> Thanks for all the reviews.
> 
> V5:
> Replace /sys/kernel/livepatch also in other/already existing tests.
> Improve commit message of 3rd patch.

JFYI, I have committed the patchset into livepatching.git,
branch for-6.13/selftests-kprobe.

I have fixed the wrong substitution in the 1st patch as suggested by Joe.

Also I have made two substitutions in test-syscall.sh in the 2nd patch
as suggested by Miroslav.

I would personally prefer to do the substitutions of existing paths
in a separate patch (same as Miroslav). But I do not think that
it was worth another respin. It would just increase risk of more
typos. And we have already spent enough time on this ;-)

Best Regards,
Petr