Re: [PATCH v2] fs/resctrl: Use open-time credentials for task move permission checks
From: Hungyu Lin
Date: Fri Dec 04 2026 - 22:02:11 EST
> I don't understand how the "trick" happens. I looked at the cgroup fix
> this is modelled on, and see the same pattern. But without details of
> the trick. The cgroup commit has a Reported-by tag, but no Link: to
> that report.
1. Root gives alice a group's tasks file:
chown alice /sys/fs/resctrl/g1/tasks
2. Alice runs:
sudo -S -p "$pid" true < /dev/null 2> /sys/fs/resctrl/g1/tasks
sudo writes the prompt, i.e. the PID, to stderr with euid 0 before
authenticating.
3. The euid 0 test passes and the task moves into g1, even when alice
does not own it.
I checked only the sudo part, with sudo 1.9.15p5 as uid 65534: euid 0
while prompting, and the prompt is a write of its own. Steps 1 and 3
are from reading the code; I have no RDT hardware to run them.
The cgroup selftest test_cgcore_lesser_euid_open() checks the same
thing on cgroup.procs: it opens the file with a non-root euid, goes
back to euid 0, and expects the write through that fd to fail with
EACCES:
https://lore.kernel.org/all/20211209214707.805617-6-tj@xxxxxxxxxx/
Thanks,
Hungyu