gpu: nvgpu: maintain authorized devices in TSG

When the TSG is successfully created first time or is opened with share
token, the device instance id associated with the CTRL fd will be added
to the TSG private data structure as authorized device instance ids.

This is used for a security check when creating a TSG share token with
nvgpu_tsg_get_share_token.

Bug 3677982
JIRA NVGPU-8681

Change-Id: I67bb0514e1272dab15023cd3828a6a51e9a4c928
Signed-off-by: Sagar Kamble <skamble@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2792080
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Scott Long <scottl@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Sagar Kamble
2022-10-09 19:03:51 +05:30
committed by mobile promotions
parent 6e2b592ab9
commit 675edd5053
6 changed files with 127 additions and 9 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2017, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2011-2022, NVIDIA CORPORATION. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
@@ -16,6 +16,8 @@
#ifndef __NVGPU_IOCTL_CTRL_H__
#define __NVGPU_IOCTL_CTRL_H__
struct gk20a_ctrl_priv;
int gk20a_ctrl_dev_open(struct inode *inode, struct file *filp);
int gk20a_ctrl_dev_release(struct inode *inode, struct file *filp);
long gk20a_ctrl_dev_ioctl(struct file *filp, unsigned int cmd, unsigned long arg);
@@ -24,4 +26,8 @@ int gk20a_ctrl_dev_mmap(struct file *filp, struct vm_area_struct *vma);
void nvgpu_hide_usermode_for_poweroff(struct gk20a *g);
void nvgpu_restore_usermode_for_poweron(struct gk20a *g);
#ifdef CONFIG_NVGPU_TSG_SHARING
u64 nvgpu_gpu_get_device_instance_id(struct gk20a_ctrl_priv *priv);
#endif
#endif