History log of /linux-6.15/tools/testing/selftests/livepatch/functions.sh (Results 1 – 24 of 24)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: v6.15, v6.15-rc7, v6.15-rc6, v6.15-rc5, v6.15-rc4, v6.15-rc3, v6.15-rc2, v6.15-rc1
# 2ca7cd80 24-Mar-2025 Filipe Xavier <[email protected]>

selftests: livepatch: add new ftrace helpers functions

Add new ftrace helpers functions cleanup_tracing, trace_function and
check_traced_functions.

Signed-off-by: Filipe Xavier <felipeaggger@gmail.

selftests: livepatch: add new ftrace helpers functions

Add new ftrace helpers functions cleanup_tracing, trace_function and
check_traced_functions.

Signed-off-by: Filipe Xavier <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Acked-by: Joe Lawrence <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Tested-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Petr Mladek <[email protected]>

show more ...


Revision tags: v6.14, v6.14-rc7, v6.14-rc6, v6.14-rc5, v6.14-rc4, v6.14-rc3, v6.14-rc2, v6.14-rc1, v6.13
# 28aecef5 19-Jan-2025 Madhavan Srinivasan <[email protected]>

selftests: livepatch: handle PRINTK_CALLER in check_result()

Some arch configs (like ppc64) enable CONFIG_PRINTK_CALLER,
which adds the caller id as part of the dmesg. With recent
util-linux's updat

selftests: livepatch: handle PRINTK_CALLER in check_result()

Some arch configs (like ppc64) enable CONFIG_PRINTK_CALLER,
which adds the caller id as part of the dmesg. With recent
util-linux's update 467a5b3192f16 ('dmesg: add caller_id support')
the standard "dmesg" has been enhanced to print PRINTK_CALLER fields.

Due to this, even though the expected vs observed are same,
end testcase results are failed.

-% insmod test_modules/test_klp_livepatch.ko
-livepatch: enabling patch 'test_klp_livepatch'
-livepatch: 'test_klp_livepatch': initializing patching transition
-livepatch: 'test_klp_livepatch': starting patching transition
-livepatch: 'test_klp_livepatch': completing patching transition
-livepatch: 'test_klp_livepatch': patching complete
-% echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled
-livepatch: 'test_klp_livepatch': initializing unpatching transition
-livepatch: 'test_klp_livepatch': starting unpatching transition
-livepatch: 'test_klp_livepatch': completing unpatching transition
-livepatch: 'test_klp_livepatch': unpatching complete
-% rmmod test_klp_livepatch
+[ T3659] % insmod test_modules/test_klp_livepatch.ko
+[ T3682] livepatch: enabling patch 'test_klp_livepatch'
+[ T3682] livepatch: 'test_klp_livepatch': initializing patching transition
+[ T3682] livepatch: 'test_klp_livepatch': starting patching transition
+[ T826] livepatch: 'test_klp_livepatch': completing patching transition
+[ T826] livepatch: 'test_klp_livepatch': patching complete
+[ T3659] % echo 0 > /sys/kernel/livepatch/test_klp_livepatch/enabled
+[ T3659] livepatch: 'test_klp_livepatch': initializing unpatching transition
+[ T3659] livepatch: 'test_klp_livepatch': starting unpatching transition
+[ T789] livepatch: 'test_klp_livepatch': completing unpatching transition
+[ T789] livepatch: 'test_klp_livepatch': unpatching complete
+[ T3659] % rmmod test_klp_livepatch

ERROR: livepatch kselftest(s) failed
not ok 1 selftests: livepatch: test-livepatch.sh # exit=1

Currently the check_result() handles the "[time]" removal from
the dmesg. Enhance the check to also handle removal of "[Thread Id]"
or "[CPU Id]".

Signed-off-by: Madhavan Srinivasan <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Tested-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Petr Mladek <[email protected]>

show more ...


Revision tags: v6.13-rc7, v6.13-rc6, v6.13-rc5, v6.13-rc4, v6.13-rc3, v6.13-rc2, v6.13-rc1, v6.12, v6.12-rc7, v6.12-rc6, v6.12-rc5, v6.12-rc4
# 59766286 17-Oct-2024 Michael Vetter <[email protected]>

selftests: livepatch: save and restore kprobe state

Save the state of /sys/kernel/debug/kprobes/enabled
during setup_config() and restore it during cleanup().

This is in preparation for a future co

selftests: livepatch: save and restore kprobe state

Save the state of /sys/kernel/debug/kprobes/enabled
during setup_config() and restore it during cleanup().

This is in preparation for a future commit that will add a test
that should confirm that we cannot livepatch a kprobed function
if that kprobe has a post handler.

Signed-off-by: Michael Vetter <[email protected]>
Reviewed-by: Miroslav Benes <[email protected]>
Reviewed-by: Joe Lawrence <[email protected]>
Tested-by: Marcos Paulo de Souza <[email protected]>
Reviewed-by: Marcos Paulo de Souza <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Tested-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[[email protected]: Added few more substitutions in test-syscall.sh]
Signed-off-by: Petr Mladek <[email protected]>

show more ...


# 637c7309 17-Oct-2024 Michael Vetter <[email protected]>

selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR

This naming makes more sense according to the directory structure.
Especially when we later add more paths.

Addtionally replace `/sys/ker

selftests: livepatch: rename KLP_SYSFS_DIR to SYSFS_KLP_DIR

This naming makes more sense according to the directory structure.
Especially when we later add more paths.

Addtionally replace `/sys/kernel/livepatch` with `$SYSFS_KLP_DIR` in
the livepatch test files.

Signed-off-by: Michael Vetter <[email protected]>
Reviewed-by: Miroslav Benes <[email protected]>
Reviewed-by: Joe Lawrence <[email protected]>
Tested-by: Marcos Paulo de Souza <[email protected]>
Reviewed-by: Marcos Paulo de Souza <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Tested-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
[[email protected]: Fix corrupted substitution]
Signed-off-by: Petr Mladek <[email protected]>

show more ...


Revision tags: v6.12-rc3, v6.12-rc2, v6.12-rc1, v6.11, v6.11-rc7, v6.11-rc6, v6.11-rc5, v6.11-rc4, v6.11-rc3, v6.11-rc2, v6.11-rc1, v6.10, v6.10-rc7, v6.10-rc6, v6.10-rc5, v6.10-rc4, v6.10-rc3, v6.10-rc2, v6.10-rc1, v6.9, v6.9-rc7, v6.9-rc6, v6.9-rc5, v6.9-rc4, v6.9-rc3, v6.9-rc2, v6.9-rc1, v6.8, v6.8-rc7, v6.8-rc6
# 54ee3526 21-Feb-2024 Marcos Paulo de Souza <[email protected]>

selftests: livepatch: Avoid running the tests if kernel-devel is missing

By checking if KDIR is a valid directory we can safely skip the tests if
kernel-devel isn't installed (default value of KDIR)

selftests: livepatch: Avoid running the tests if kernel-devel is missing

By checking if KDIR is a valid directory we can safely skip the tests if
kernel-devel isn't installed (default value of KDIR), or if KDIR
variable passed doesn't exists.

Reported-by: kernel test robot <[email protected]>
Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
Signed-off-by: Marcos Paulo de Souza <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


Revision tags: v6.8-rc5, v6.8-rc4, v6.8-rc3, v6.8-rc2, v6.8-rc1, v6.7, v6.7-rc8, v6.7-rc7
# f1fea725 20-Dec-2023 Joe Lawrence <[email protected]>

selftests/livepatch: fix and refactor new dmesg message code

The livepatching kselftests rely on comparing expected vs. observed
dmesg output. After each test, new dmesg entries are determined by t

selftests/livepatch: fix and refactor new dmesg message code

The livepatching kselftests rely on comparing expected vs. observed
dmesg output. After each test, new dmesg entries are determined by the
'comm' utility comparing a saved, pre-test copy of dmesg to post-test
dmesg output.

Alexander reports that the 'comm --nocheck-order -13' invocation used by
the tests can be confused when dmesg entry timestamps vary in magnitude
(ie, "[ 98.820331]" vs. "[ 100.031067]"), in which case, additional
messages are reported as new. The unexpected entries then spoil the
test results.

Instead of relying on 'comm' or 'diff' to determine new testing dmesg
entries, refactor the code:

- pre-test : log a unique canary dmesg entry
- test : run tests, log messages
- post-test : filter dmesg starting from pre-test message

Reported-by: Alexander Gordeev <[email protected]>
Closes: https://lore.kernel.org/live-patching/[email protected]/
Signed-off-by: Joe Lawrence <[email protected]>
Acked-by: Alexander Gordeev <[email protected]>
Tested-by: Marcos Paulo de Souza <[email protected]>
Reviewed-by: Marcos Paulo de Souza <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


# c4bbe83d 12-Jan-2024 Marcos Paulo de Souza <[email protected]>

livepatch: Move tests from lib/livepatch to selftests/livepatch

The modules are being moved from lib/livepatch to
tools/testing/selftests/livepatch/test_modules.

This code moving will allow writing

livepatch: Move tests from lib/livepatch to selftests/livepatch

The modules are being moved from lib/livepatch to
tools/testing/selftests/livepatch/test_modules.

This code moving will allow writing more complex tests, like for example an
userspace C code that will call a livepatched kernel function.

The modules are now built as out-of-tree
modules, but being part of the kernel source means they will be maintained.

Another advantage of the code moving is to be able to easily change,
debug and rebuild the tests by running make on the selftests/livepatch
directory, which is not currently possible since the modules on
lib/livepatch are build and installed using the "modules" target.

The current approach also keeps the ability to execute the tests manually
by executing the scripts inside selftests/livepatch directory, as it's
currently supported. If the modules are modified, they needed to be
rebuilt before running the scripts though.

The modules are built before running the selftests when using the
kselftest invocations:

make kselftest TARGETS=livepatch
or
make -C tools/testing/selftests/livepatch run_tests

Having the modules being built as out-of-modules requires changing the
currently used 'modprobe' by 'insmod' and adapt the test scripts that
check for the kernel message buffer.

Now it is possible to only compile the modules by running:

make -C tools/testing/selftests/livepatch/

This way the test modules and other test program can be built in order
to be packaged if so desired.

As there aren't any modules being built on lib/livepatch, remove the
TEST_LIVEPATCH Kconfig and it's references.

Note: "make gen_tar" packages the pre-built binaries into the tarball.
It means that it will store the test modules pre-built for
the kernel running on the build host.

Note that these modules need not binary compatible with
the kernel built from the same sources. But the same
is true for other packaged selftest binaries.

The entire kernel sources are needed for rebuilding
the selftests on another system.

Reviewed-by: Joe Lawrence <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Marcos Paulo de Souza <[email protected]>
Acked-by: Alexander Gordeev <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


Revision tags: v6.7-rc6, v6.7-rc5, v6.7-rc4, v6.7-rc3, v6.7-rc2, v6.7-rc1, v6.6, v6.6-rc7, v6.6-rc6, v6.6-rc5, v6.6-rc4, v6.6-rc3, v6.6-rc2, v6.6-rc1, v6.5, v6.5-rc7, v6.5-rc6, v6.5-rc5, v6.5-rc4, v6.5-rc3, v6.5-rc2, v6.5-rc1, v6.4, v6.4-rc7, v6.4-rc6, v6.4-rc5, v6.4-rc4, v6.4-rc3, v6.4-rc2, v6.4-rc1, v6.3, v6.3-rc7, v6.3-rc6, v6.3-rc5, v6.3-rc4, v6.3-rc3, v6.3-rc2, v6.3-rc1, v6.2, v6.2-rc8, v6.2-rc7, v6.2-rc6, v6.2-rc5, v6.2-rc4, v6.2-rc3, v6.2-rc2, v6.2-rc1, v6.1, v6.1-rc8, v6.1-rc7, v6.1-rc6, v6.1-rc5, v6.1-rc4, v6.1-rc3, v6.1-rc2, v6.1-rc1, v6.0, v6.0-rc7, v6.0-rc6, v6.0-rc5, v6.0-rc4
# ff1b80ec 02-Sep-2022 Song Liu <[email protected]>

selftests/livepatch: add sysfs test

Add a test for livepatch sysfs entries.

Signed-off-by: Song Liu <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Petr Mladek <pmladek

selftests/livepatch: add sysfs test

Add a test for livepatch sysfs entries.

Signed-off-by: Song Liu <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


Revision tags: v6.0-rc3, v6.0-rc2, v6.0-rc1
# 857300b7 11-Aug-2022 Joe Lawrence <[email protected]>

selftests/livepatch: normalize sysctl error message

The livepatch kselftests rely on comparing expected and actual output
from such commands as sysctl. A recent commit in procps-ng v4.0.0 [1]
chang

selftests/livepatch: normalize sysctl error message

The livepatch kselftests rely on comparing expected and actual output
from such commands as sysctl. A recent commit in procps-ng v4.0.0 [1]
changed sysctl's output to emit key pathnames like:

sysctl: setting key "/proc/sys/kernel/ftrace_enabled": Device or resource busy

versus previous dotted output:

sysctl: setting key "kernel.ftrace_enabled": Device or resource busy

The modification in output was later reverted [2], but since the change
has been tagged in procps-ng v4.0.0, update the livepatch kselftest to
handle either case.

[1] https://gitlab.com/procps-ng/procps/-/commit/6389deca5bf667f5fab5912acde78ba8e0febbc7
[2] https://gitlab.com/procps-ng/procps/-/commit/b159c198c9160a8eb13254e2b631d0035b9b542c

Reported-by: Dennis(Zhuoheng) Li <[email protected]>
Signed-off-by: Joe Lawrence <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


Revision tags: v5.19, v5.19-rc8, v5.19-rc7, v5.19-rc6, v5.19-rc5, v5.19-rc4, v5.19-rc3, v5.19-rc2, v5.19-rc1, v5.18, v5.18-rc7, v5.18-rc6, v5.18-rc5, v5.18-rc4, v5.18-rc3, v5.18-rc2, v5.18-rc1, v5.17, v5.17-rc8, v5.17-rc7, v5.17-rc6, v5.17-rc5
# 4327b9ea 16-Feb-2022 David Vernet <[email protected]>

livepatch: Skip livepatch tests if ftrace cannot be configured

livepatch has a set of selftests that are used to validate the behavior of
the livepatching subsystem. One of the testcases in the liv

livepatch: Skip livepatch tests if ftrace cannot be configured

livepatch has a set of selftests that are used to validate the behavior of
the livepatching subsystem. One of the testcases in the livepatch
testsuite is test-ftrace.sh, which among other things, validates that
livepatching gracefully fails when ftrace is disabled. In the event that
ftrace cannot be disabled using 'sysctl kernel.ftrace_enabled=0', the test
will fail later due to it unexpectedly successfully loading the
test_klp_livepatch module.

While the livepatch selftests are careful to remove any of the livepatch
test modules between testcases to avoid this situation, ftrace may still
fail to be disabled if another trace is active on the system that was
enabled with FTRACE_OPS_FL_PERMANENT. For example, any active BPF programs
that use trampolines will cause this test to fail due to the trampoline
being implemented with register_ftrace_direct(). The following is an
example of such a trace:

tcp_drop (1) R I D tramp: ftrace_regs_caller+0x0/0x58
(call_direct_funcs+0x0/0x30)
direct-->bpf_trampoline_6442550536_0+0x0/0x1000

In order to make the test more resilient to system state that is out of its
control, this patch updates set_ftrace_enabled() to detect sysctl failures,
and skip the testrun when appropriate.

Suggested-by: Petr Mladek <[email protected]>
Signed-off-by: David Vernet <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Tested-by: Petr Mladek <[email protected]>
Acked-by: Joe Lawrence <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


Revision tags: v5.17-rc4, v5.17-rc3, v5.17-rc2, v5.17-rc1, v5.16, v5.16-rc8, v5.16-rc7, v5.16-rc6, v5.16-rc5, v5.16-rc4, v5.16-rc3, v5.16-rc2, v5.16-rc1, v5.15, v5.15-rc7, v5.15-rc6, v5.15-rc5, v5.15-rc4, v5.15-rc3, v5.15-rc2, v5.15-rc1, v5.14, v5.14-rc7, v5.14-rc6, v5.14-rc5, v5.14-rc4, v5.14-rc3, v5.14-rc2, v5.14-rc1, v5.13, v5.13-rc7, v5.13-rc6, v5.13-rc5, v5.13-rc4, v5.13-rc3, v5.13-rc2, v5.13-rc1, v5.12, v5.12-rc8, v5.12-rc7, v5.12-rc6, v5.12-rc5, v5.12-rc4, v5.12-rc3, v5.12-rc2, v5.12-rc1, v5.12-rc1-dontuse, v5.11, v5.11-rc7, v5.11-rc6, v5.11-rc5, v5.11-rc4, v5.11-rc3, v5.11-rc2, v5.11-rc1, v5.10, v5.10-rc7, v5.10-rc6, v5.10-rc5, v5.10-rc4, v5.10-rc3, v5.10-rc2, v5.10-rc1, v5.9, v5.9-rc8, v5.9-rc7, v5.9-rc6, v5.9-rc5, v5.9-rc4, v5.9-rc3
# 884ee754 27-Aug-2020 Miroslav Benes <[email protected]>

selftests/livepatch: Do not check order when using "comm" for dmesg checking

check_result() uses "comm" to check expected results of selftests output
in dmesg. Everything works fine if timestamps in

selftests/livepatch: Do not check order when using "comm" for dmesg checking

check_result() uses "comm" to check expected results of selftests output
in dmesg. Everything works fine if timestamps in dmesg are unique. If
not, like in this example

[ 86.844422] test_klp_callbacks_demo: pre_unpatch_callback: test_klp_callbacks_mod -> [MODULE_STATE_LIVE] Normal state
[ 86.844422] livepatch: 'test_klp_callbacks_demo': starting unpatching transition

, "comm" fails with "comm: file 2 is not in sorted order". Suppress the
order checking with --nocheck-order option.

Fixes: 2f3f651f3756 ("selftests/livepatch: Use "comm" instead of "diff" for dmesg")
Signed-off-by: Miroslav Benes <[email protected]>
Acked-by: Joe Lawrence <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>

show more ...


Revision tags: v5.9-rc2, v5.9-rc1, v5.8, v5.8-rc7, v5.8-rc6
# 5e4d4688 14-Jul-2020 Petr Mladek <[email protected]>

selftests/livepatch: adopt to newer sysctl error format

With procfs v3.3.16, the sysctl command doesn't print the set key and
value on error. This change breaks livepatch selftest test-ftrace.sh,
t

selftests/livepatch: adopt to newer sysctl error format

With procfs v3.3.16, the sysctl command doesn't print the set key and
value on error. This change breaks livepatch selftest test-ftrace.sh,
that tests the interaction of sysctl ftrace_enabled:

Make it work with all sysctl versions using '-q' option.

Explicitly print the final status on success so that it can be verified
in the log. The error message is enough on failure.

Reported-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Reviewed-by: Joe Lawrence <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


Revision tags: v5.8-rc5
# 2f3f651f 10-Jul-2020 Joe Lawrence <[email protected]>

selftests/livepatch: Use "comm" instead of "diff" for dmesg

BusyBox diff doesn't support the GNU diff '--LTYPE-line-format' options
that were used in the selftests to filter older kernel log message

selftests/livepatch: Use "comm" instead of "diff" for dmesg

BusyBox diff doesn't support the GNU diff '--LTYPE-line-format' options
that were used in the selftests to filter older kernel log messages from
dmesg output.

Use "comm" which is more available in smaller boot environments.

Reported-by: Naresh Kamboju <[email protected]>
Signed-off-by: Joe Lawrence <[email protected]>
Reviewed-by: Yannick Cote <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


Revision tags: v5.8-rc4, v5.8-rc3, v5.8-rc2
# 3fd9bd8b 18-Jun-2020 Joe Lawrence <[email protected]>

selftests/livepatch: add test delimiter to dmesg

Make it bit easier to parse the kernel logs during the selftests by
adding a "===== TEST: $test =====" delimiter when each individual test
begins.

S

selftests/livepatch: add test delimiter to dmesg

Make it bit easier to parse the kernel logs during the selftests by
adding a "===== TEST: $test =====" delimiter when each individual test
begins.

Suggested-by: Petr Mladek <[email protected]>
Signed-off-by: Joe Lawrence <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Reviewed-by: Yannick Cote <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


# c401088f 18-Jun-2020 Joe Lawrence <[email protected]>

selftests/livepatch: refine dmesg 'taints' in dmesg comparison

The livepatch selftests currently grep on "taints" to filter out
"tainting kernel with TAINT_LIVEPATCH" messages which may be logged wh

selftests/livepatch: refine dmesg 'taints' in dmesg comparison

The livepatch selftests currently grep on "taints" to filter out
"tainting kernel with TAINT_LIVEPATCH" messages which may be logged when
loading livepatch modules.

Further filter the log to drop "loading out-of-tree module taints
kernel" in the rare case the klp_test modules have been built
out-of-tree.

Look for the longer "taints kernel" or "tainting kernel" strings to
avoid inadvertent partial matching.

Signed-off-by: Joe Lawrence <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Reviewed-by: Yannick Cote <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


# 2eeb0d45 18-Jun-2020 Joe Lawrence <[email protected]>

selftests/livepatch: Don't clear dmesg when running tests

Inspired by commit f131d9edc29d ("selftests/lkdtm: Don't clear dmesg
when running tests"), keep a reference dmesg copy when beginning each
t

selftests/livepatch: Don't clear dmesg when running tests

Inspired by commit f131d9edc29d ("selftests/lkdtm: Don't clear dmesg
when running tests"), keep a reference dmesg copy when beginning each
test. This way check_result() can compare against the initial copy
rather than relying upon an empty log.

Signed-off-by: Joe Lawrence <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Reviewed-by: Yannick Cote <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]

show more ...


Revision tags: v5.8-rc1, v5.7, v5.7-rc7, v5.7-rc6, v5.7-rc5, v5.7-rc4, v5.7-rc3, v5.7-rc2, v5.7-rc1, v5.6, v5.6-rc7, v5.6-rc6, v5.6-rc5, v5.6-rc4, v5.6-rc3, v5.6-rc2, v5.6-rc1, v5.5, v5.5-rc7
# e1dae517 13-Jan-2020 Miroslav Benes <[email protected]>

selftests/livepatch: Remove unused local variable in set_ftrace_enabled()

set_ftrace_enabled() contains unused local variable "sysctl". Remove it.

Signed-off-by: Miroslav Benes <[email protected]>
Rev

selftests/livepatch: Remove unused local variable in set_ftrace_enabled()

set_ftrace_enabled() contains unused local variable "sysctl". Remove it.

Signed-off-by: Miroslav Benes <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


Revision tags: v5.5-rc6, v5.5-rc5, v5.5-rc4, v5.5-rc3
# 05564c29 16-Dec-2019 Shuah Khan <[email protected]>

selftests: livepatch: Fix it to do root uid check and skip

livepatch test configures the system and debug environment to run
tests. Some of these actions fail without root access and test
dumps seve

selftests: livepatch: Fix it to do root uid check and skip

livepatch test configures the system and debug environment to run
tests. Some of these actions fail without root access and test
dumps several permission denied messages before it exits.

Fix test-state.sh to call setup_config instead of set_dynamic_debug
as suggested by Petr Mladek <[email protected]>

Fix it to check root uid and exit with skip code instead.

Signed-off-by: Shuah Khan <[email protected]>
Acked-by: Joe Lawrence <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


Revision tags: v5.5-rc2, v5.5-rc1, v5.4, v5.4-rc8, v5.4-rc7, v5.4-rc6, v5.4-rc5, v5.4-rc4
# 8c666d2a 16-Oct-2019 Joe Lawrence <[email protected]>

selftests/livepatch: Test interaction with ftrace_enabled

Since livepatching depends upon ftrace handlers to implement "patched"
code functionality, verify that the ftrace_enabled sysctl value
inter

selftests/livepatch: Test interaction with ftrace_enabled

Since livepatching depends upon ftrace handlers to implement "patched"
code functionality, verify that the ftrace_enabled sysctl value
interacts with livepatch registration as expected. At the same time,
ensure that ftrace_enabled is set and part of the test environment
configuration that is saved and restored when running the selftests.

Link: http://lkml.kernel.org/r/[email protected]

Signed-off-by: Joe Lawrence <[email protected]>
Signed-off-by: Miroslav Benes <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>

show more ...


# 35c9e74c 16-Oct-2019 Joe Lawrence <[email protected]>

selftests/livepatch: Make dynamic debug setup and restore generic

Livepatch selftests currently save the current dynamic debug config and
tweak it for the selftests. The config is restored at the en

selftests/livepatch: Make dynamic debug setup and restore generic

Livepatch selftests currently save the current dynamic debug config and
tweak it for the selftests. The config is restored at the end. Make the
infrastructure generic, so that more variables can be saved and
restored.

Link: http://lkml.kernel.org/r/[email protected]

Signed-off-by: Joe Lawrence <[email protected]>
Signed-off-by: Miroslav Benes <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>

show more ...


Revision tags: v5.4-rc3, v5.4-rc2, v5.4-rc1, v5.3, v5.3-rc8, v5.3-rc7, v5.3-rc6, v5.3-rc5, v5.3-rc4, v5.3-rc3, v5.3-rc2, v5.3-rc1
# fbb01c52 18-Jul-2019 Joe Lawrence <[email protected]>

selftests/livepatch: push and pop dynamic debug config

The livepatching self-tests tweak the dynamic debug config to verify
the kernel log during the tests. Enhance set_dynamic_debug() so that
the

selftests/livepatch: push and pop dynamic debug config

The livepatching self-tests tweak the dynamic debug config to verify
the kernel log during the tests. Enhance set_dynamic_debug() so that
the config changes are restored when the script exits.

Note this functionality needs to keep in sync with:
- dynamic_debug input/output formatting
- functions affected by set_dynamic_debug()

For example, push_dynamic_debug() transforms:
kernel/livepatch/transition.c:530 [livepatch]klp_init_transition =_ "'%s': initializing %s transition\012"
to the following:
file kernel/livepatch/transition.c line 530 =_

Signed-off-by: Joe Lawrence <[email protected]>
Tested-by: Petr Mladek <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


# 527d37e9 24-Jul-2019 Joe Lawrence <[email protected]>

selftests/livepatch: add test skip handling

Add a skip() message function that stops the test, logs an explanation,
and sets the "skip" return code (4).

Before loading a livepatch self-test kernel

selftests/livepatch: add test skip handling

Add a skip() message function that stops the test, logs an explanation,
and sets the "skip" return code (4).

Before loading a livepatch self-test kernel module, first verify that
we've built and installed it by running a 'modprobe --dry-run'. This
should catch a few environment issues, including !CONFIG_LIVEPATCH and
!CONFIG_TEST_LIVEPATCH. In these cases, exit gracefully with the new
skip() function.

Reported-by: Jiri Benc <[email protected]>
Suggested-by: Shuah Khan <[email protected]>
Reviewed-by: Petr Mladek <[email protected]>
Signed-off-by: Joe Lawrence <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>

show more ...


Revision tags: v5.2, v5.2-rc7, v5.2-rc6, v5.2-rc5, v5.2-rc4, v5.2-rc3, v5.2-rc2, v5.2-rc1, v5.1, v5.1-rc7, v5.1-rc6, v5.1-rc5, v5.1-rc4, v5.1-rc3, v5.1-rc2, v5.1-rc1, v5.0, v5.0-rc8, v5.0-rc7, v5.0-rc6
# fbb76d57 08-Feb-2019 Joe Lawrence <[email protected]>

livepatch/selftests: use "$@" to preserve argument list

The livepatch selftest functions.sh library uses "$*" and an
intermediate variable to extract and then pass arguments from function
to functio

livepatch/selftests: use "$@" to preserve argument list

The livepatch selftest functions.sh library uses "$*" and an
intermediate variable to extract and then pass arguments from function
to function call. The effect of this combination is that the argument
list is flattened into a single argument. Sometimes this is benign, but
in cases like __load_mod(), the modprobe invocation will interpret all
the module parameters as a single parameter.

Drop the intermediate variable and use the "$@" special parameter as
described in the bash manual.

Link: https://www.gnu.org/software/bash/manual/bash.html#Special-Parameters
Signed-off-by: Joe Lawrence <[email protected]>
Reviewed-by: Kamalesh Babulal <[email protected]>
Acked-by: Miroslav Benes <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>

show more ...


Revision tags: v5.0-rc5, v5.0-rc4, v5.0-rc3, v5.0-rc2
# a2818ee4 09-Jan-2019 Joe Lawrence <[email protected]>

selftests/livepatch: introduce tests

Add a few livepatch modules and simple target modules that the included
regression suite can run tests against:

- basic livepatching (multiple patches, atomic

selftests/livepatch: introduce tests

Add a few livepatch modules and simple target modules that the included
regression suite can run tests against:

- basic livepatching (multiple patches, atomic replace)
- pre/post (un)patch callbacks
- shadow variable API

Signed-off-by: Joe Lawrence <[email protected]>
Signed-off-by: Petr Mladek <[email protected]>
Tested-by: Miroslav Benes <[email protected]>
Tested-by: Alice Ferrazzi <[email protected]>
Acked-by: Joe Lawrence <[email protected]>
Acked-by: Josh Poimboeuf <[email protected]>
Signed-off-by: Jiri Kosina <[email protected]>

show more ...