linux/tools
David Vernet 4327b9eaf8 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 <pmladek@suse.com>
Signed-off-by: David Vernet <void@manifault.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20220216161100.3243100-1-void@manifault.com
2022-02-23 16:42:00 +01:00
..
accounting
arch x86/mmx_32: Remove X86_USE_3DNOW 2021-12-11 09:09:45 +01:00
bootconfig bootconfig: Cleanup dummy headers in tools/bootconfig 2021-10-10 22:16:02 -04:00
bpf libbpf 1.0: Deprecate bpf_map__is_offload_neutral() 2022-01-05 16:09:06 -08:00
build Merge https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2021-12-10 15:56:13 -08:00
cgroup
counter tools/counter: Create Counter tools 2021-10-17 10:54:16 +01:00
debugging
edid
firewire
firmware
gpio
hv
iio iio: event_monitor: Flush output on event 2021-12-16 12:20:35 +00:00
include RCU pull request for v5.17 2022-01-11 09:29:44 -08:00
io_uring tools/io_uring/io_uring-cp: sync with liburing example 2021-08-13 08:58:11 -06:00
kvm/kvm_stat KVM: kvm_stat: do not show halt_wait_ns 2021-10-18 14:07:18 -04:00
laptop
leds
lib libbpf: Add documentation for bpf_map batch operations 2022-01-06 15:12:42 -08:00
memory-model tools/memory-model: litmus: Add two tests for unlock(A)+lock(B) ordering 2021-11-30 17:47:08 -08:00
objtool - Get rid of all the .fixup sections because this generates 2022-01-12 16:31:19 -08:00
pci
pcmcia
perf Networking changes for 5.17. 2022-01-10 19:06:09 -08:00
power platform-drivers-x86 for v5.17-1 2022-01-11 11:26:57 -08:00
rcu tools/rcu: Add an extract-stall script 2021-09-16 10:31:26 -07:00
scripts tools: Help cross-building with clang 2021-12-16 12:15:04 -08:00
spi
testing livepatch: Skip livepatch tests if ftrace cannot be configured 2022-02-23 16:42:00 +01:00
thermal/tmon thermal: tools: tmon: remove unneeded local variable 2021-11-24 17:26:13 +01:00
time
tracing tools/latency-collector: Use correct size when writing queue_full_warning 2021-10-25 22:27:19 -04:00
usb usb: testusb: Fix for showing the connection speed 2021-09-14 10:31:41 +02:00
virtio tools/virtio: fix build 2021-08-11 06:44:24 -04:00
vm tools/vm/page-types.c: print file offset in hexadecimal 2021-11-06 13:30:40 -07:00
wmi
Makefile tools/lib/lockdep: drop liblockdep 2021-11-12 11:07:17 -08:00