linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1] selftests/ftrace: Skip test for optimized probes on PowerPC if Secure Boot is enabled
@ 2024-07-16 11:26 Akanksha J N
  2024-07-19 16:59 ` Steven Rostedt
  0 siblings, 1 reply; 2+ messages in thread
From: Akanksha J N @ 2024-07-16 11:26 UTC (permalink / raw)
  To: linux-kernel, linux-trace-kernel, linux-kselftest
  Cc: shuah, mathieu.desnoyers, mhiramat, rostedt, naveen, akanksha

Currently while accessing debugfs with Secure Boot enabled on PowerPC,
it is causing the kprobe_opt_types.tc test to fail. Below is the snippet
of the error:

+++ grep kernel_clone /sys/kernel/debug/kprobes/list
grep: /sys/kernel/debug/kprobes/list: Operation not permitted
++ PROBE=
+ '[' 2 -ne 0 ']'
+ kill -s 37 7595
++ SIG_RESULT=1
+ eval_result 1
+ case $1 in
+ prlog '	[\033[31mFAIL\033[0m]'
+ newline='\n'
+ '[' '	[\033[31mFAIL\033[0m]' = -n ']'
+ printf '	[\033[31mFAIL\033[0m]\n'
	[FAIL]

This is happening when secure boot is enabled, as it enables lockdown
by default. With lockdown, access to certain debug features and
filesystems like debugfs may be restricted or completely disabled.

To fix this, modify the test to check for Secure Boot status using
lsprop /proc/device-tree/ibm,secure-boot. And, skip execution of the
test on PowerPC if Secure Boot is enabled (00000002).

With this patch, test skips as unsupported:
=== Ftrace unit tests ===
[1] Register/unregister optimized probe	[UNSUPPORTED]

Signed-off-by: Akanksha J N <akanksha@linux.ibm.com>
---
 .../selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc       | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc
index 9f5d99328086..87e2f81e46b8 100644
--- a/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc
+++ b/tools/testing/selftests/ftrace/test.d/kprobe/kprobe_opt_types.tc
@@ -10,6 +10,11 @@ x86_64)
 arm*)
 ;;
 ppc*)
+lsprop_output=$(lsprop /proc/device-tree/ibm,secure-boot)
+if echo "$lsprop_output" | grep -q "00000002"; then
+	echo "Secure Boot is enabled on PowerPC."
+	exit_unsupported
+fi
 ;;
 *)
   echo "Please implement other architecture here"
-- 
2.39.3 (Apple Git-146)


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

end of thread, other threads:[~2024-07-19 16:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-16 11:26 [PATCH v1] selftests/ftrace: Skip test for optimized probes on PowerPC if Secure Boot is enabled Akanksha J N
2024-07-19 16:59 ` Steven Rostedt

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).