disp: msm: sde: prevent custom ioctls from accessing unowned HW

Early wakeup ioctls from perf HAL driver can access display HW
registers and come as a sideband to atomic commits. Since the
atomic validate checks are not part of this code path it's
possible for HW access to occur during a trusted UI session.
Prevent this whenever the HW is not under this VM's ownership.
Also, move the VM ownership check for the register/deregister
event ioctl to cover both the CRTC and connector events since
new connector events are being added which can access HW.

Change-Id: I39660ae60e7e8f8a405e819c43ec42fbac3f492a
Signed-off-by: Steve Cohen <cohens@codeaurora.org>
这个提交包含在:
Steve Cohen
2021-08-10 17:15:02 -04:00
父节点 6bf96605eb
当前提交 9690b545df
修改 3 个文件,包含 22 行新增17 行删除

查看文件

@@ -4046,9 +4046,15 @@ static void sde_encoder_early_wakeup_work_handler(struct kthread_work *work)
{
struct sde_encoder_virt *sde_enc = container_of(work,
struct sde_encoder_virt, early_wakeup_work);
struct sde_vm_ops *vm_ops;
struct sde_kms *sde_kms = to_sde_kms(ddev_to_msm_kms(sde_enc->base.dev));
if (!sde_enc) {
SDE_ERROR("invalid sde encoder\n");
vm_ops = sde_vm_get_ops(sde_kms);
sde_vm_lock(sde_kms);
if (vm_ops && vm_ops->vm_owns_hw && !vm_ops->vm_owns_hw(sde_kms)) {
sde_vm_unlock(sde_kms);
SDE_DEBUG("skip early wakeup for ENC-%d, HW is owned by other VM\n",
DRMID(&sde_enc->base));
return;
}
@@ -4056,6 +4062,7 @@ static void sde_encoder_early_wakeup_work_handler(struct kthread_work *work)
sde_encoder_resource_control(&sde_enc->base,
SDE_ENC_RC_EVENT_EARLY_WAKEUP);
SDE_ATRACE_END("encoder_early_wakeup");
sde_vm_unlock(sde_kms);
}
void sde_encoder_early_wakeup(struct drm_encoder *drm_enc)