[PATCH v5 6/8] selinux: Restrict cross-cgroup memcg charging
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Wed Nov 18 08:41:03 UTC 2026
> The security_memcg_charge_task() hook allows security modules
> to control which processes may charge/transfer memcg
> memory to another process's cgroup outside their tree. Without
> a policy implementation, the hook is a no-op and the restriction
> is not enforced.
>
> On SELinux-managed systems the only limit is CAP_SYS_RESOURCE. A
> domain that holds both dma-heap access (today's only exporter that
> opts-in) and that capability, can charge memory to any cgroup outside
> its own subtree. Since the capability is all-or-nothing, SELinux
> policy cannot express which targets such a domain may charge to.
>
> Implement selinux_memcg_charge_task() using avc_has_perm() from
> the process2 object class and a new charge_to permission. Policy
> authors can then grant cross-cgroup charging selectively,
> for example:
>
> allow allocator_app_t client_app_t:process2 charge_to;
>
> Signed-off-by: Albert Esteve <aesteve at redhat.com>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261117-v2_20230123_tjmercier_google_com-v5-0-1ce975f2a9ad@redhat.com?part=6
More information about the Linux-security-module-archive
mailing list