Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Akanksha J N <akanksha@linux.ibm.com>
Cc: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, shuah@kernel.org,
	mathieu.desnoyers@efficios.com, mhiramat@kernel.org,
	rostedt@goodmis.org
Subject: Re: [PATCH v2] selftests/ftrace: Skip test for optimized probes on PowerPC if Secure Boot is enabled
Date: Sun, 25 Aug 2024 17:35:57 +0900	[thread overview]
Message-ID: <20240825173557.89c64ab5362b0fa78df2f45a@kernel.org> (raw)
In-Reply-To: <20240813034056.74717-1-akanksha@linux.ibm.com>

On Tue, 13 Aug 2024 09:10:56 +0530
Akanksha J N <akanksha@linux.ibm.com> wrote:

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

Hmm, if the kprobes lockdown causes this problem, all tests which use
kprobes must not run. This seems onlu checks kprobe_opt_types.tc, but
what about other tests?

(Anyway, we don't recommend user to run tests in lockdown environment.)

Thank you,

> 
> 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..925e74d6acc7 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.45.2
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

      reply	other threads:[~2024-08-25  8:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13  3:40 [PATCH v2] selftests/ftrace: Skip test for optimized probes on PowerPC if Secure Boot is enabled Akanksha J N
2024-08-25  8:35 ` Masami Hiramatsu [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240825173557.89c64ab5362b0fa78df2f45a@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=akanksha@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=rostedt@goodmis.org \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox