public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Luck <tony.luck-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Ramesh Thomas
	<ramesh.thomas-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Using cgroup membership for resource access control?
Date: Mon, 6 Feb 2023 13:21:05 -0800	[thread overview]
Message-ID: <Y+FvQbfTdcTe9GVu@agluck-desk3.sc.intel.com> (raw)

Hi,

Cgroups primary function seems to be to divide limited resources and
make sure that they are allocated "fairly" (where the sysadmin decides
what is fair, and how much of each resource should be made available to
groups of processes).

Intel has a h/w feature in the DSA (Data Streaming Accelerator) device
that will allow a process to offer access to bounded virtual windows
into its address space to other processes.

The case where one process wants to make this offer to just one other
process seems simple.

But the h/w allows, and a process might want, to offer a virtual window
to several other processes. As soon as anyone says the words "several
processes" the immediate thought is "can cgroups help with this?"

I'm thinking along these lines:

1) Sysadmin creates a cgroup for a "job". Initializes the limits on
how many of these virtual windows can be used (h/w has a fixed number).
Assigns tasks in the job to this cgroup.

2) Tasks in the job that want to offer virtual windows call into the
driver to allocate and partially set up windows tagged with "available
to any other process in my cgroup".

3) Other tasks in the group ask the driver to complete the h/w
initialization by adding them (their PASID) to the access list
for each window.

My questions:

1) Is this horrible - have I misunderstood cgroups?
	1a) If this is horrible, can it be rescued?

2) Will it work - is "membership in a cgroup" a valid security mechanism?

3) Has someone done something similar before (so I can learn from their code)?

4) Is there an existing exported API to help. I see task_cgroup_path()
which looks generally helpful (though I'd prefer a task_cgroup() that
just takes a task and gives me the cgroup to which it belongs.)

Thanks

-Tony

             reply	other threads:[~2023-02-06 21:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-06 21:21 Tony Luck [this message]
     [not found] ` <Y+FvQbfTdcTe9GVu-E6Nu+q68HHQWLgLFz2vlpa2pdiUAq4bhAL8bYrjMMd8@public.gmane.org>
2023-02-06 21:42   ` Using cgroup membership for resource access control? Tejun Heo
     [not found]     ` <Y+F0NA9iI0zlONz7-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-02-06 21:43       ` Tejun Heo
     [not found]         ` <Y+F0mXS9z0flDhf7-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-02-06 22:18           ` Luck, Tony
     [not found]             ` <SJ1PR11MB6083C61BCA70A31F8C0F12ECFCDA9-0NYKzF1JBnQoAmWoDslVMJPPoyLQLiKMvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2023-02-06 23:30               ` Tejun Heo
     [not found]                 ` <Y+GNp4VA1T9pV6nM-NiLfg/pYEd1N0TnZuCh8vA@public.gmane.org>
2023-02-07  0:48                   ` Luck, Tony

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=Y+FvQbfTdcTe9GVu@agluck-desk3.sc.intel.com \
    --to=tony.luck-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=ramesh.thomas-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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