From: Peter Senna Tschudin <peter.senna@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Peter Senna Tschudin <peter.senna@linux.intel.com>
Subject: [PATCH v2 i-g-t 2/2] tests/intel/xe_compute: check root-only write permission for ccs_mode
Date: Sun, 18 Jan 2026 21:00:10 +0100 [thread overview]
Message-ID: <20260118200010.18669-2-peter.senna@linux.intel.com> (raw)
In-Reply-To: <20260118200010.18669-1-peter.senna@linux.intel.com>
Add a call to igt_fs_check_root_perm() in test_ccs_mode() to verify that
the "ccs_mode" sysfs attribute is writable only by root. This enforces a
security requirement that only root can modify "ccs_mode", preventing
unintended or unauthorized writes by other users.
Signed-off-by: Peter Senna Tschudin <peter.senna@linux.intel.com>
---
Changes from v1:
- Moved the test to after the existing test
- Check for file not found and skip when it is the case
tests/intel/xe_compute.c | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/tests/intel/xe_compute.c b/tests/intel/xe_compute.c
index 310093fc5..eb2410a0a 100644
--- a/tests/intel/xe_compute.c
+++ b/tests/intel/xe_compute.c
@@ -14,6 +14,7 @@
#include <string.h>
#include "igt.h"
+#include "igt_fs.h"
#include "igt_sysfs.h"
#include "intel_compute.h"
#include "xe/xe_ioctl.h"
@@ -88,7 +89,7 @@ test_ccs_mode(void)
{
struct drm_xe_engine_class_instance *hwe;
u32 gt, m, ccs_mode, vm, q, num_slices;
- int fd, gt_fd, num_gt_with_ccs_mode = 0;
+ int fd, file_perm_res, gt_fd, num_gt_with_ccs_mode = 0;
uint64_t gt_mask = get_gt_mask();
/*
@@ -102,6 +103,20 @@ test_ccs_mode(void)
num_gt_with_ccs_mode++;
gt_fd = gt_sysfs_open(gt);
igt_assert(igt_sysfs_printf(gt_fd, "ccs_mode", "%u", 0) < 0);
+
+ /* Check if ccs_mode is writeble only by root. Having root only
+ * write permission is a security requirement.
+ */
+ file_perm_res = igt_fs_check_root_perm(gt_fd, "ccs_mode");
+ if (file_perm_res == -ENOENT) {
+ igt_skip("ccs_mode sysfs entry not found\n");
+ } else if (file_perm_res < 0) {
+ igt_skip("Cannot stat ccs_mode file\n");
+ } else {
+ igt_assert_f(file_perm_res == 0,
+ "ccs_mode sysfs entry has incorrect permissions\n");
+ }
+
for (m = 1; m <= num_slices; m++) {
/* compute slices are to be equally distributed among enabled engines */
if (num_slices % m) {
--
2.43.0
next prev parent reply other threads:[~2026-01-18 20:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-09 13:08 [PATCH i-g-t 0/2] tests/intel/xe_compute: check root-only write permission for ccs_mode Peter Senna Tschudin
2025-09-09 13:08 ` [PATCH i-g-t 1/2] lib/igt_fs: add igt_fs_check_root_perm() helper Peter Senna Tschudin
2025-09-12 15:57 ` Kamil Konieczny
2025-09-09 13:08 ` [PATCH i-g-t 2/2] tests/intel/xe_compute: check root-only write permission for ccs_mode Peter Senna Tschudin
2025-09-15 12:28 ` Kamil Konieczny
2025-09-10 0:20 ` ✓ Xe.CI.BAT: success for " Patchwork
2025-09-10 0:26 ` ✓ i915.CI.BAT: " Patchwork
2025-09-10 7:16 ` ✓ Xe.CI.Full: " Patchwork
2025-09-10 13:04 ` ✗ i915.CI.Full: failure " Patchwork
2026-01-18 20:00 ` [PATCH v2 i-g-t 1/2] lib/igt_fs: add igt_fs_check_root_perm() helper Peter Senna Tschudin
2026-01-18 20:00 ` Peter Senna Tschudin [this message]
2026-01-19 12:29 ` [PATCH v2 i-g-t 2/2] tests/intel/xe_compute: check root-only write permission for ccs_mode Kamil Konieczny
2026-01-18 20:33 ` ✓ Xe.CI.BAT: success for tests/intel/xe_compute: check root-only write permission for ccs_mode (rev2) Patchwork
2026-01-18 20:51 ` ✓ i915.CI.BAT: " Patchwork
2026-01-18 21:40 ` ✗ Xe.CI.Full: failure " Patchwork
2026-01-18 22:55 ` ✗ i915.CI.Full: " Patchwork
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=20260118200010.18669-2-peter.senna@linux.intel.com \
--to=peter.senna@linux.intel.com \
--cc=igt-dev@lists.freedesktop.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