Context |
Check |
Description |
ltpci/debian_stable_s390x-linux-gnu-gcc_s390x |
success
|
success
|
ltpci/debian_stable_powerpc64le-linux-gnu-gcc_ppc64el |
success
|
success
|
ltpci/debian_stable_aarch64-linux-gnu-gcc_arm64 |
success
|
success
|
ltpci/debian_stable_gcc |
success
|
success
|
ltpci/debian_stable_gcc |
success
|
success
|
ltpci/ubuntu_jammy_gcc |
success
|
success
|
ltpci/ubuntu_bionic_gcc |
success
|
success
|
ltpci/debian_oldstable_clang |
success
|
success
|
ltpci/debian_testing_gcc |
success
|
success
|
ltpci/fedora_latest_clang |
success
|
success
|
ltpci/alpine_latest_gcc |
success
|
success
|
ltpci/opensuse-archive_42-2_gcc |
success
|
success
|
ltpci/quay-io-centos-centos_stream9_gcc |
success
|
success
|
ltpci/debian_oldstable_gcc |
success
|
success
|
ltpci/opensuse-leap_latest_gcc |
success
|
success
|
ltpci/debian_testing_clang |
success
|
success
|
@@ -760,6 +760,7 @@ lseek07 lseek07
lseek11 lseek11
lsm_get_self_attr01 lsm_get_self_attr01
+lsm_get_self_attr02 lsm_get_self_attr02
lstat01 lstat01
lstat01_64 lstat01_64
@@ -1 +1,2 @@
lsm_get_self_attr01
+lsm_get_self_attr02
new file mode 100644
@@ -0,0 +1,45 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2024 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * Verify that lsm_get_self_attr syscall is acting correctly when ctx is NULL.
+ * The syscall can behave in different ways according to the current system
+ * status:
+ *
+ * - if any LSM is running inside the system, the syscall will pass and it will
+ * provide a size as big as the attribute
+ * - if no LSM(s) are running inside the system, the syscall will fail with -1
+ * return code
+ */
+#include "lsm_common.h"
+
+static uint32_t page_size;
+static uint32_t lsm_count;
+
+static void run(void)
+{
+ uint32_t size = page_size;
+
+ if (lsm_count) {
+ TST_EXP_POSITIVE(lsm_get_self_attr(
+ LSM_ATTR_CURRENT, NULL, &size, 0));
+ TST_EXP_EXPR(size > 1);
+ } else {
+ TST_EXP_FAIL(lsm_get_self_attr(
+ LSM_ATTR_CURRENT, NULL, &size, 0), EOPNOTSUPP);
+ }
+}
+
+static void setup(void)
+{
+ page_size = SAFE_SYSCONF(_SC_PAGESIZE);
+ lsm_count = count_supported_attr_current();
+}
+
+static struct tst_test test = {
+ .test_all = run,
+ .setup = setup,
+ .min_kver = "6.8",
+};