public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH 0/2] insmod01.sh: Skip test on enabled lockdown
@ 2023-03-08  9:32 Petr Vorel
  2023-03-08  9:32 ` [LTP] [PATCH 1/2] lib: shell: Add tst_lockdown_enabled.c Petr Vorel
  2023-03-08  9:32 ` [LTP] [PATCH 2/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
  0 siblings, 2 replies; 4+ messages in thread
From: Petr Vorel @ 2023-03-08  9:32 UTC (permalink / raw)
  To: ltp

Petr Vorel (2):
  lib: shell: Add tst_lockdown_enabled.c
  insmod01.sh: Skip test on enabled lockdown

 doc/test-writing-guidelines.txt       |  2 +-
 testcases/commands/insmod/insmod01.sh |  2 ++
 testcases/lib/.gitignore              |  1 +
 testcases/lib/Makefile                |  2 +-
 testcases/lib/tst_lockdown_enabled.c  | 12 ++++++++++++
 testcases/lib/tst_test.sh             |  6 +++++-
 6 files changed, 22 insertions(+), 3 deletions(-)
 create mode 100644 testcases/lib/tst_lockdown_enabled.c

-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH 1/2] lib: shell: Add tst_lockdown_enabled.c
  2023-03-08  9:32 [LTP] [PATCH 0/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
@ 2023-03-08  9:32 ` Petr Vorel
  2023-03-08  9:32 ` [LTP] [PATCH 2/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
  1 sibling, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2023-03-08  9:32 UTC (permalink / raw)
  To: ltp

Detection is needed for insmod01.sh.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 doc/test-writing-guidelines.txt      |  2 +-
 testcases/lib/.gitignore             |  1 +
 testcases/lib/Makefile               |  2 +-
 testcases/lib/tst_lockdown_enabled.c | 12 ++++++++++++
 testcases/lib/tst_test.sh            |  6 +++++-
 5 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 testcases/lib/tst_lockdown_enabled.c

diff --git a/doc/test-writing-guidelines.txt b/doc/test-writing-guidelines.txt
index b83a6fdb6..875c20eae 100644
--- a/doc/test-writing-guidelines.txt
+++ b/doc/test-writing-guidelines.txt
@@ -392,7 +392,7 @@ https://github.com/linux-test-project/ltp/wiki/Shell-Test-API[Shell Test API].
 | '.setup' | 'TST_SETUP'
 | '.skip_filesystems' | 'TST_SKIP_FILESYSTEMS'
 | '.skip_in_compat' | –
-| '.skip_in_lockdown' | –
+| '.skip_in_lockdown' | 'TST_SKIP_IN_LOCKDOWN'
 | '.supported_archs' | not applicable
 | '.tags' | –
 | '.taint_check' | –
diff --git a/testcases/lib/.gitignore b/testcases/lib/.gitignore
index 34dea272d..61cf05226 100644
--- a/testcases/lib/.gitignore
+++ b/testcases/lib/.gitignore
@@ -8,6 +8,7 @@
 /tst_get_median
 /tst_get_unused_port
 /tst_kvcmp
+/tst_lockdown_enabled
 /tst_net_iface_prefix
 /tst_net_ip_prefix
 /tst_net_vars
diff --git a/testcases/lib/Makefile b/testcases/lib/Makefile
index f4f8c8524..6fd58b3ab 100644
--- a/testcases/lib/Makefile
+++ b/testcases/lib/Makefile
@@ -12,6 +12,6 @@ MAKE_TARGETS		:= tst_sleep tst_random tst_checkpoint tst_rod tst_kvcmp\
 			   tst_device tst_net_iface_prefix tst_net_ip_prefix tst_net_vars\
 			   tst_getconf tst_supported_fs tst_check_drivers tst_get_unused_port\
 			   tst_get_median tst_hexdump tst_get_free_pids tst_timeout_kill\
-			   tst_check_kconfigs tst_cgctl
+			   tst_check_kconfigs tst_cgctl tst_lockdown_enabled
 
 include $(top_srcdir)/include/mk/generic_leaf_target.mk
diff --git a/testcases/lib/tst_lockdown_enabled.c b/testcases/lib/tst_lockdown_enabled.c
new file mode 100644
index 000000000..0e40c428c
--- /dev/null
+++ b/testcases/lib/tst_lockdown_enabled.c
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (c) 2023 Petr Vorel <pvorel@suse.cz>
+ */
+
+#define TST_NO_DEFAULT_MAIN
+#include "tst_test.h"
+
+int main(void)
+{
+	return !tst_lockdown_enabled();
+}
diff --git a/testcases/lib/tst_test.sh b/testcases/lib/tst_test.sh
index c817eec77..50939d4e4 100644
--- a/testcases/lib/tst_test.sh
+++ b/testcases/lib/tst_test.sh
@@ -678,7 +678,7 @@ tst_run()
 			CHECKPOINT_WAIT|CHECKPOINT_WAKE);;
 			CHECKPOINT_WAKE2|CHECKPOINT_WAKE_AND_WAIT);;
 			DEV_EXTRA_OPTS|DEV_FS_OPTS|FORMAT_DEVICE|MOUNT_DEVICE);;
-			SKIP_FILESYSTEMS);;
+			SKIP_FILESYSTEMS|SKIP_IN_LOCKDOWN);;
 			*) tst_res TWARN "Reserved variable TST_$_tst_i used!";;
 			esac
 		done
@@ -698,6 +698,10 @@ tst_run()
 
 	[ "$TST_NEEDS_ROOT" = 1 ] && tst_require_root
 
+	if [ "$TST_SKIP_IN_LOCKDOWN" = 1 ] && tst_lockdown_enabled; then
+		tst_brk TCONF "Kernel is locked down, skipping test"
+	fi
+
 	[ "$TST_DISABLE_APPARMOR" = 1 ] && tst_disable_apparmor
 	[ "$TST_DISABLE_SELINUX" = 1 ] && tst_disable_selinux
 
-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* [LTP] [PATCH 2/2] insmod01.sh: Skip test on enabled lockdown
  2023-03-08  9:32 [LTP] [PATCH 0/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
  2023-03-08  9:32 ` [LTP] [PATCH 1/2] lib: shell: Add tst_lockdown_enabled.c Petr Vorel
@ 2023-03-08  9:32 ` Petr Vorel
  2023-03-08 11:09   ` Petr Vorel
  1 sibling, 1 reply; 4+ messages in thread
From: Petr Vorel @ 2023-03-08  9:32 UTC (permalink / raw)
  To: ltp

Lockdown patchset does not allow to install LTP kernel module:

insmod: ERROR: could not insert module ltp_insmod01.ko: Operation not permitted
insmod01 1 TFAIL: insmod failed

Therefore skip the test on enabled lockdown.

Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1208920
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
 testcases/commands/insmod/insmod01.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testcases/commands/insmod/insmod01.sh b/testcases/commands/insmod/insmod01.sh
index 1881ba389..fb1e56459 100755
--- a/testcases/commands/insmod/insmod01.sh
+++ b/testcases/commands/insmod/insmod01.sh
@@ -1,6 +1,7 @@
 #!/bin/sh
 # SPDX-License-Identifier: GPL-2.0-or-later
 # Copyright (c) 2016 Fujitsu Ltd.
+# Copyright (c) Linux Test Project, 2016-2023
 # Author: Guangwen Feng <fenggw-fnst@cn.fujitsu.com>
 #
 # Test basic functionality of insmod command.
@@ -10,6 +11,7 @@ TST_TESTFUNC=do_test
 TST_NEEDS_ROOT=1
 TST_NEEDS_CMDS="rmmod insmod"
 TST_NEEDS_MODULE="ltp_insmod01.ko"
+TST_SKIP_IN_LOCKDOWN=1
 
 inserted=0
 
-- 
2.39.2


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

* Re: [LTP] [PATCH 2/2] insmod01.sh: Skip test on enabled lockdown
  2023-03-08  9:32 ` [LTP] [PATCH 2/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
@ 2023-03-08 11:09   ` Petr Vorel
  0 siblings, 0 replies; 4+ messages in thread
From: Petr Vorel @ 2023-03-08 11:09 UTC (permalink / raw)
  To: ltp

Hi all,

> Lockdown patchset does not allow to install LTP kernel module:

> insmod: ERROR: could not insert module ltp_insmod01.ko: Operation not permitted
> insmod01 1 TFAIL: insmod failed

> Therefore skip the test on enabled lockdown.

> Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1208920

OK, this is probably our downstream issue in openSUSE.
And because insmod01.sh was the only one shell test which needed this,
even previous commit would not be used.
Thus marking whole patchset as rejected.

Kind regards,
Petr

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

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

end of thread, other threads:[~2023-03-08 11:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08  9:32 [LTP] [PATCH 0/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
2023-03-08  9:32 ` [LTP] [PATCH 1/2] lib: shell: Add tst_lockdown_enabled.c Petr Vorel
2023-03-08  9:32 ` [LTP] [PATCH 2/2] insmod01.sh: Skip test on enabled lockdown Petr Vorel
2023-03-08 11:09   ` Petr Vorel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox