mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hungyu Lin <dennylin0707@gmail.com>
To: tony.luck@intel.com, reinette.chatre@intel.com
Cc: x86@kernel.org, Dave.Martin@arm.com, james.morse@arm.com,
	babu.moger@amd.com, ben.horgan@arm.com, fustini@kernel.org,
	tglx@kernel.org, fenghua.yu@intel.com, josef@toxicpanda.com,
	linux-kernel@vger.kernel.org, dennylin0707@gmail.com
Subject: [PATCH v2] fs/resctrl: Use open-time credentials for task move permission checks
Date: Fri, 20 Nov 2026 09:00:22 +0000	[thread overview]
Message-ID: <20261120090022.44526-1-dennylin0707@gmail.com> (raw)

Writing a PID to a resctrl group's "tasks" file moves that task into the
group. Whether the move is allowed depends on the PID written, so
rdtgroup_task_write_permission() checks it at write time, applying the
same cred_ids_allow_move() rule as __cgroup1_procs_write().

It checks current's credentials. That may allow a less privileged
process to trick a more privileged one into writing into a fd that it
opened. Commit 1756d7994ad8 ("cgroup: Use open-time credentials for
process migraton perm checks") closed the same hole in cgroup by using
the credentials saved at open time. rdtgroup_task_write_permission()
still uses current_cred().

Use of->file->f_cred instead, as cgroup1 does.

Fixes: e02737d5b826 ("x86/intel_rdt: Add tasks files")
Cc: stable@vger.kernel.org
Signed-off-by: Hungyu Lin <dennylin0707@gmail.com>
---
v2:
- Rebased onto commit 27369da9c651 ("fs/resctrl: use
  cred_ids_allow_move()") in linux-next.
- Dropped the comment change.

v1: https://lore.kernel.org/all/20261107093253.62518-1-dennylin0707@gmail.com/

 fs/resctrl/rdtgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c
index 6e81b58e4cb8..c9b35fc2b513 100644
--- a/fs/resctrl/rdtgroup.c
+++ b/fs/resctrl/rdtgroup.c
@@ -725,7 +725,7 @@ static int rdtgroup_task_write_permission(struct task_struct *task,
 					  struct kernfs_open_file *of)
 {
 	const struct cred *tcred = get_task_cred(task);
-	const struct cred *cred = current_cred();
+	const struct cred *cred = of->file->f_cred;
 	int ret = 0;
 
 	/*
-- 
2.43.0

                 reply	other threads:[~2026-11-20  9:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261120090022.44526-1-dennylin0707@gmail.com \
    --to=dennylin0707@gmail.com \
    --cc=Dave.Martin@arm.com \
    --cc=babu.moger@amd.com \
    --cc=ben.horgan@arm.com \
    --cc=fenghua.yu@intel.com \
    --cc=fustini@kernel.org \
    --cc=james.morse@arm.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=reinette.chatre@intel.com \
    --cc=tglx@kernel.org \
    --cc=tony.luck@intel.com \
    --cc=x86@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

all inboxes | Powered by JetHome®