From: Roman Gushchin <guro-b10kYP2dOMg@public.gmane.org>
To: "Kasiviswanathan,
Harish" <Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
Cc: "cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org"
<amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org>
Subject: Re: [PATCH v2 3/4] device_cgroup: Export devcgroup_check_permission
Date: Fri, 17 May 2019 17:06:35 +0000 [thread overview]
Message-ID: <20190517170630.GA1646@tower.DHCP.thefacebook.com> (raw)
In-Reply-To: <20190517161435.14121-4-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
On Fri, May 17, 2019 at 04:15:06PM +0000, Kasiviswanathan, Harish wrote:
> For AMD compute (amdkfd) driver.
>
> All AMD compute devices are exported via single device node /dev/kfd. As
> a result devices cannot be controlled individually using device cgroup.
>
> AMD compute devices will rely on its graphics counterpart that exposes
> /dev/dri/renderN node for each device. For each task (based on its
> cgroup), KFD driver will check if /dev/dri/renderN node is accessible
> before exposing it.
>
> Change-Id: I1b9705b2c30622a27655f4f878980fa138dbf373
> Signed-off-by: Harish Kasiviswanathan <Harish.Kasiviswanathan@amd.com>
> ---
> include/linux/device_cgroup.h | 19 ++++---------------
> security/device_cgroup.c | 15 +++++++++++++--
> 2 files changed, 17 insertions(+), 17 deletions(-)
>
> diff --git a/include/linux/device_cgroup.h b/include/linux/device_cgroup.h
> index 8557efe096dc..bd19897bd582 100644
> --- a/include/linux/device_cgroup.h
> +++ b/include/linux/device_cgroup.h
> @@ -12,26 +12,15 @@
> #define DEVCG_DEV_ALL 4 /* this represents all devices */
>
> #ifdef CONFIG_CGROUP_DEVICE
> -extern int __devcgroup_check_permission(short type, u32 major, u32 minor,
> - short access);
> +extern int devcgroup_check_permission(short type, u32 major, u32 minor,
> + short access);
> #else
> -static inline int __devcgroup_check_permission(short type, u32 major, u32 minor,
> - short access)
> +static inline int devcgroup_check_permission(short type, u32 major, u32 minor,
> + short access)
> { return 0; }
> #endif
>
> #if defined(CONFIG_CGROUP_DEVICE) || defined(CONFIG_CGROUP_BPF)
> -static inline int devcgroup_check_permission(short type, u32 major, u32 minor,
> - short access)
> -{
> - int rc = BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type, major, minor, access);
> -
> - if (rc)
> - return -EPERM;
> -
> - return __devcgroup_check_permission(type, major, minor, access);
> -}
> -
> static inline int devcgroup_inode_permission(struct inode *inode, int mask)
> {
> short type, access = 0;
> diff --git a/security/device_cgroup.c b/security/device_cgroup.c
> index cd97929fac66..3c57e05bf73b 100644
> --- a/security/device_cgroup.c
> +++ b/security/device_cgroup.c
> @@ -801,8 +801,8 @@ struct cgroup_subsys devices_cgrp_subsys = {
> *
> * returns 0 on success, -EPERM case the operation is not permitted
> */
> -int __devcgroup_check_permission(short type, u32 major, u32 minor,
> - short access)
> +static int __devcgroup_check_permission(short type, u32 major, u32 minor,
> + short access)
> {
> struct dev_cgroup *dev_cgroup;
> bool rc;
> @@ -824,3 +824,14 @@ int __devcgroup_check_permission(short type, u32 major, u32 minor,
>
> return 0;
> }
> +
> +int devcgroup_check_permission(short type, u32 major, u32 minor, short access)
> +{
> + int rc = BPF_CGROUP_RUN_PROG_DEVICE_CGROUP(type, major, minor, access);
> +
> + if (rc)
> + return -EPERM;
> +
> + return __devcgroup_check_permission(type, major, minor, access);
> +}
> +EXPORT_SYMBOL(devcgroup_check_permission);
Perfect, now looks good to me!
Please, feel free to use my acks for patches 3 and 4:
Acked-by: Roman Gushchin <guro@fb.com>
Thanks!
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
next prev parent reply other threads:[~2019-05-17 17:06 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-17 16:14 [PATCH v2 0/4] AMDKFD (AMD GPU compute) support for device cgroup Kasiviswanathan, Harish
[not found] ` <20190517161435.14121-1-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
2019-05-17 16:15 ` [PATCH v2 1/4] drm/amdkfd: Store kfd_dev in iolink and cache properties Kasiviswanathan, Harish
2019-05-17 16:15 ` [PATCH v2 2/4] drm/amd: Pass drm_device to kfd Kasiviswanathan, Harish
2019-05-17 16:15 ` [PATCH v2 3/4] device_cgroup: Export devcgroup_check_permission Kasiviswanathan, Harish
[not found] ` <20190517161435.14121-4-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
2019-05-17 17:06 ` Roman Gushchin [this message]
2019-05-17 16:15 ` [PATCH v2 4/4] drm/amdkfd: Check against device cgroup Kasiviswanathan, Harish
[not found] ` <20190517161435.14121-5-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
2019-05-17 20:12 ` Kuehling, Felix
[not found] ` <e547c0a1-e153-c3a6-79bc-67f59f364c3e-5C7GfCeVMHo@public.gmane.org>
2019-05-28 19:02 ` Tejun Heo
[not found] ` <20190528190239.GM374014-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2019-05-29 20:45 ` Kuehling, Felix
[not found] ` <d39ec6a7-b30d-404b-c8d1-4e22604e0c8e-5C7GfCeVMHo@public.gmane.org>
2019-05-29 21:15 ` Tejun Heo
2019-05-17 16:49 ` [PATCH v2 0/4] AMDKFD (AMD GPU compute) support for " Tejun Heo
[not found] ` <20190517164937.GF374014-LpCCV3molIbIZ9tKgghJQw2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2019-05-17 20:04 ` Kasiviswanathan, Harish
[not found] ` <BYAPR12MB3384A590739D7E18B736CB368C0B0-ZGDeBxoHBPn6x/DOKSkw2AdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-05-28 18:58 ` Tejun Heo
-- strict thread matches above, loose matches on Subject: below --
2019-09-16 18:05 Kasiviswanathan, Harish
[not found] ` <20190916180523.27341-1-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
2019-09-16 18:05 ` [PATCH v2 3/4] device_cgroup: Export devcgroup_check_permission Kasiviswanathan, Harish
[not found] ` <20190916180523.27341-4-Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org>
2019-09-24 15:54 ` Kasiviswanathan, Harish
[not found] ` <MN2PR12MB2911F59E9B91AAD349B4E40F8C840-rweVpJHSKTpv4wpD+z6awQdYzm3356FpvxpqHgZTriW3zl9H0oFU5g@public.gmane.org>
2019-09-24 17:13 ` Roman Gushchin
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=20190517170630.GA1646@tower.DHCP.thefacebook.com \
--to=guro-b10kyp2domg@public.gmane.org \
--cc=Harish.Kasiviswanathan-5C7GfCeVMHo@public.gmane.org \
--cc=amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=cgroups-u79uwXL29TY76Z2rM5mHXA@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