linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kselftests/damon: add support for checking secureboot status
@ 2022-06-24 19:52 Gautam
  2022-06-24 20:29 ` SeongJae Park
  0 siblings, 1 reply; 11+ messages in thread
From: Gautam @ 2022-06-24 19:52 UTC (permalink / raw)
  To: sj, shuah; +Cc: Gautam, damon, linux-mm, linux-kselftest, linux-kernel

The kernel is in lockdown mode when secureboot is enabled and hence
debugfs cannot be used. But the error printed after running tests does
not indicate this currently:

>TAP version 13
>1..6
># selftests: damon: debugfs_attrs.sh
># cat: /sys/kernel/debug/damon/monitor_on: Operation not permitted
># _debugfs_common.sh: line 48: [: =: unary operator expected
># cat: /sys/kernel/debug/damon/attrs: Operation not permitted
># _debugfs_common.sh: line 11: /sys/kernel/debug/damon/attrs: Operation 
> not permitted
># writing 1 2 3 4 5 to /sys/kernel/debug/damon/attrs doesn't return 0
># expected because: valid input
># _debugfs_common.sh: line 16: /sys/kernel/debug/damon/attrs: Operation 
> not permitted
>not ok 1 selftests: damon: debugfs_attrs.sh # exit=1


After adding the check for secureboot, the output is as follows:

>TAP version 13
>1..6
># selftests: damon: debugfs_attrs.sh
># debugfs cannot work with secureboot enabled
>not ok 1 selftests: damon: debugfs_attrs.sh # exit=1


Signed-off-by: Gautam <gautammenghani201@gmail.com>
---
 tools/testing/selftests/damon/_chk_dependency.sh | 10 ++++++++++
 1 file changed, 10 insertions(+)
 mode change 100644 => 100755 tools/testing/selftests/damon/_chk_dependency.sh

diff --git a/tools/testing/selftests/damon/_chk_dependency.sh b/tools/testing/selftests/damon/_chk_dependency.sh
old mode 100644
new mode 100755
index 0189db81550b..6e45c1fe230e
--- a/tools/testing/selftests/damon/_chk_dependency.sh
+++ b/tools/testing/selftests/damon/_chk_dependency.sh
@@ -26,3 +26,13 @@ do
 		exit 1
 	fi
 done
+
+secureboot_error="Operation not permitted"
+for f in attrs target_ids monitor_on
+do
+	status=$( cat "$DBGFS/$f" 2>&1 )
+	if [ "${status#*$secureboot_error}" != "$status" ]; then
+		echo "debugfs cannot work with secureboot enabled"
+		exit 1
+	fi
+done
-- 
2.36.1



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

end of thread, other threads:[~2022-06-28  3:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-24 19:52 [PATCH] kselftests/damon: add support for checking secureboot status Gautam
2022-06-24 20:29 ` SeongJae Park
2022-06-25  5:56   ` [PATCH v2] kselftests/damon: add support for cases where debugfs cannot be read Gautam
2022-06-25  8:35     ` [PATCH v3] " Gautam
2022-06-25 18:55       ` SeongJae Park
2022-06-25 19:52         ` [PATCH v4] " Gautam
2022-06-25 20:03           ` SeongJae Park
2022-06-27 17:00             ` Shuah Khan
2022-06-27 18:57               ` SeongJae Park
2022-06-27 19:46                 ` Shuah Khan
     [not found]               ` <Yrn6BxU298rzjiak@fedora>
2022-06-28  3:37                 ` Gautam Menghani

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