All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] livepatch: Move tests from lib/livepatch to selftests/livepatch
@ 2022-06-03 14:32 Marcos Paulo de Souza
  2022-06-03 14:32 ` [PATCH 1/2] " Marcos Paulo de Souza
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Marcos Paulo de Souza @ 2022-06-03 14:32 UTC (permalink / raw)
  To: live-patching, linux-kselftest
  Cc: shuah, jpoimboe, mbenes, pmladek, Marcos Paulo de Souza

Hi there,

The first patch moves the current livepatch tests to selftests, allowing it
be better suited to contain more complex tests, like using userspace C code
to use the livepatched kernel code. As a bonus it allows to use
"gen_tar" to export the livepatch selftests, rebuild the modules by
running make in selftests/livepatch directory and simplifies the process
of creating and debugging new selftests.

It keeps the ability to execute the tests by running the shell scripts,
like "test-livepatch.sh", but beware that the kernel modules
might not be up-to-date.

The second patch includes a new test to exercise the functionality to livepatch
a heavy hammered function. The test uses getpid in this case.

I tested the changes by running the tests within the kernel source tree and running
from the gen_tar extracted directory.

Marcos Paulo de Souza (2):
  livepatch: Move tests from lib/livepatch to selftests/livepatch
  selftests: livepatch: Test livepatching a heavily called syscall

 arch/s390/configs/debug_defconfig             |  1 -
 arch/s390/configs/defconfig                   |  1 -
 lib/Kconfig.debug                             | 22 -------
 lib/Makefile                                  |  2 -
 lib/livepatch/Makefile                        | 14 -----
 tools/testing/selftests/livepatch/Makefile    | 35 ++++++++++-
 tools/testing/selftests/livepatch/README      |  5 +-
 tools/testing/selftests/livepatch/config      |  1 -
 .../testing/selftests/livepatch/functions.sh  | 34 ++++-------
 .../selftests/livepatch/test-callbacks.sh     | 50 ++++++++--------
 .../selftests/livepatch/test-ftrace.sh        |  6 +-
 .../selftests/livepatch/test-livepatch.sh     | 10 ++--
 .../selftests/livepatch/test-shadow-vars.sh   |  2 +-
 .../testing/selftests/livepatch/test-state.sh | 18 +++---
 .../selftests/livepatch/test-syscall.sh       | 46 ++++++++++++++
 .../test_binaries/test_klp-call_getpid.c      | 48 +++++++++++++++
 .../selftests/livepatch/test_modules/Makefile | 25 ++++++++
 .../test_modules}/test_klp_atomic_replace.c   |  0
 .../test_modules}/test_klp_callbacks_busy.c   |  0
 .../test_modules}/test_klp_callbacks_demo.c   |  0
 .../test_modules}/test_klp_callbacks_demo2.c  |  0
 .../test_modules}/test_klp_callbacks_mod.c    |  0
 .../test_modules}/test_klp_livepatch.c        |  0
 .../test_modules}/test_klp_shadow_vars.c      |  0
 .../livepatch/test_modules}/test_klp_state.c  |  0
 .../livepatch/test_modules}/test_klp_state2.c |  0
 .../livepatch/test_modules}/test_klp_state3.c |  0
 .../livepatch/test_modules/test_klp_syscall.c | 60 +++++++++++++++++++
 28 files changed, 269 insertions(+), 111 deletions(-)
 delete mode 100644 lib/livepatch/Makefile
 create mode 100755 tools/testing/selftests/livepatch/test-syscall.sh
 create mode 100644 tools/testing/selftests/livepatch/test_binaries/test_klp-call_getpid.c
 create mode 100644 tools/testing/selftests/livepatch/test_modules/Makefile
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_atomic_replace.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_callbacks_busy.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_callbacks_demo.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_callbacks_demo2.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_callbacks_mod.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_livepatch.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_shadow_vars.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_state.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_state2.c (100%)
 rename {lib/livepatch => tools/testing/selftests/livepatch/test_modules}/test_klp_state3.c (100%)
 create mode 100644 tools/testing/selftests/livepatch/test_modules/test_klp_syscall.c

-- 
2.35.3


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

end of thread, other threads:[~2022-06-17 21:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-03 14:32 [PATCH 0/2] livepatch: Move tests from lib/livepatch to selftests/livepatch Marcos Paulo de Souza
2022-06-03 14:32 ` [PATCH 1/2] " Marcos Paulo de Souza
2022-06-09 20:00   ` Shuah Khan
2022-06-09 20:13     ` Shuah Khan
2022-06-03 14:32 ` [PATCH 2/2] selftests: livepatch: Test livepatching a heavily called syscall Marcos Paulo de Souza
2022-06-17 21:17   ` Joe Lawrence
2022-06-09 20:16 ` [PATCH 0/2] livepatch: Move tests from lib/livepatch to selftests/livepatch Shuah Khan
2022-06-10 13:06   ` Joe Lawrence
2022-06-10 14:48     ` Petr Mladek
2022-06-14  1:02       ` Shuah Khan
2022-06-10 13:50   ` Marcos Paulo de Souza

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.