From patchwork Wed Apr 17 11:25:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10905251 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AB85C13B5 for ; Wed, 17 Apr 2019 11:25:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 96F8B28A6C for ; Wed, 17 Apr 2019 11:25:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8A10228A96; Wed, 17 Apr 2019 11:25:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,UPPERCASE_50_75 autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3916428A6C for ; Wed, 17 Apr 2019 11:25:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A77B06E033; Wed, 17 Apr 2019 11:25:29 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8733C6E033; Wed, 17 Apr 2019 11:25:28 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id g3so31422756wrx.9; Wed, 17 Apr 2019 04:25:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=xhbuZWKDWSVhY0V2gcUDshTUYS35H5gtfhHXZ/yS38M=; b=QgY1++38olUlbaf8KVPp+J5gpfbgYApKZYCruyEi7k8laxopG2BkMsyIfcL4pZ9KNP FGvaqeTAhcR/WHjqCF4bGus1Lp/tffNKRr8JHjIqx10C14FC461V1K7Mi3oOTXspScYr cq0zEr+S6fsOBGq6VAI1Kn0WwWHPjWAaZHl3vFzGYkfWBvXTkR+EeKF9kVQPxzPlt9rV QSh46HNKS2CbPksa0nIUDhAHn/QN6m420ysw7XHuP+FyniKW04iAVuhfOnckcG1SUti2 3LRru4oshyQvIpgp0D7nT5OfVyM3bP5zYlZqpa4LVkr/Npa+JiKuf2pIVA5SXhA9XYWM 7sxg== X-Gm-Message-State: APjAAAX4w5VyJNtZ42c862yN40jWEhIN/QCjOPhWaMBKmhPAhweFjZ1w A19eVz1aL++vF86yKTOXZ/P8g3Ng X-Google-Smtp-Source: APXvYqyydU3jBcsBnVqd73YdKK0DLO9tFsE0yLq4Qsba6GJiQ9977xzzOBOOcPC+GWWCjhA7PZ/PzA== X-Received: by 2002:adf:e949:: with SMTP id m9mr54464900wrn.237.1555500327069; Wed, 17 Apr 2019 04:25:27 -0700 (PDT) Received: from laptop.fritz.box ([2a02:908:1252:fb60:be8a:bd56:1f94:86e7]) by smtp.gmail.com with ESMTPSA id u189sm4215196wme.25.2019.04.17.04.25.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 04:25:26 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, airlied@linux.ie, emil.velikov@collabora.com, andresx7@gmail.com, keithp@keithp.com, Alexander.Deucher@amd.com Date: Wed, 17 Apr 2019 13:25:24 +0200 Message-Id: <20190417112525.16848-1-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=xhbuZWKDWSVhY0V2gcUDshTUYS35H5gtfhHXZ/yS38M=; b=Rw4ksfLF2y+421zXasUOjjfC+/k2Xj4vxD1Lng+rM90Oxpx47o5qz78sw6k0OmSP9H a9FK89HKYhdpXz5nyPsyy2S6t0sWgpDmhqHe98exU+xevdTRrF9adI5z3nj1jIpGv145 5CQt+z9anxuBJRjYTMFyMgbnKuSe9W6LMNPMfr/ru24uQc05/QPp30bhdErcxrHCPx1O VzXuiUszA+wAPp+xkhTvGPtw0kJB2kZjdzftoJQh5EygP6HEryprk1hvVcsUSkUnmpjr vMDE1p2hSvYPt7cyN5D9i9rybUx1pAaBMBEF2bGjLJXf98qYBJXzIf67104vG1gJncGD J8pA== Subject: [Intel-gfx] [PATCH 1/2] drm/i915: remove DRM_AUTH from IOCTLs which also have DRM_RENDER_ALLOW X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This is to work around problems with libva and vainfo. Signed-off-by: Christian König Reviewed-by: Chris Wilson Reviewed-by: Daniel Vetter --- drivers/gpu/drm/i915/i915_drv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index bbe1a5d56480..12615641a34b 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -3039,7 +3039,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_BATCHBUFFER, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_IRQ_EMIT, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_IRQ_WAIT, drm_noop, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GETPARAM, i915_getparam_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_SETPARAM, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_ALLOC, drm_noop, DRM_AUTH), DRM_IOCTL_DEF_DRV(I915_FREE, drm_noop, DRM_AUTH), @@ -3052,13 +3052,13 @@ static const struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_HWS_ADDR, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_GEM_INIT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER, i915_gem_execbuffer_ioctl, DRM_AUTH), - DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_EXECBUFFER2_WR, i915_gem_execbuffer2_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_PIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_GEM_UNPIN, i915_gem_reject_pin_ioctl, DRM_AUTH|DRM_ROOT_ONLY), - DRM_IOCTL_DEF_DRV(I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_BUSY, i915_gem_busy_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_SET_CACHING, i915_gem_set_caching_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_GET_CACHING, i915_gem_get_caching_ioctl, DRM_RENDER_ALLOW), - DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_THROTTLE, i915_gem_throttle_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_ENTERVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_GEM_LEAVEVT, drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY), DRM_IOCTL_DEF_DRV(I915_GEM_CREATE, i915_gem_create_ioctl, DRM_RENDER_ALLOW), @@ -3077,7 +3077,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = { DRM_IOCTL_DEF_DRV(I915_OVERLAY_ATTRS, intel_overlay_attrs_ioctl, DRM_MASTER), DRM_IOCTL_DEF_DRV(I915_SET_SPRITE_COLORKEY, intel_sprite_set_colorkey_ioctl, DRM_MASTER), DRM_IOCTL_DEF_DRV(I915_GET_SPRITE_COLORKEY, drm_noop, DRM_MASTER), - DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_AUTH|DRM_RENDER_ALLOW), + DRM_IOCTL_DEF_DRV(I915_GEM_WAIT, i915_gem_wait_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_CREATE_EXT, i915_gem_context_create_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_GEM_CONTEXT_DESTROY, i915_gem_context_destroy_ioctl, DRM_RENDER_ALLOW), DRM_IOCTL_DEF_DRV(I915_REG_READ, i915_reg_read_ioctl, DRM_RENDER_ALLOW), From patchwork Wed Apr 17 11:25:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 10905255 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 170A613B5 for ; Wed, 17 Apr 2019 11:25:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 036D928A6C for ; Wed, 17 Apr 2019 11:25:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EB97C28A96; Wed, 17 Apr 2019 11:25:34 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A906A28A6C for ; Wed, 17 Apr 2019 11:25:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 99F3089258; Wed, 17 Apr 2019 11:25:30 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7EFD96E035; Wed, 17 Apr 2019 11:25:29 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id y13so31497373wrd.3; Wed, 17 Apr 2019 04:25:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ofyJS1XJHfP8cHGUS+SH0RuqxI7q3EciFASc2cwAjoA=; b=iP2LpvVI7WmOpAvUL5k7s/IU1yR+WZ7r5wH60ENzLXpWmbf4UzElWMQz1ohwSBYU5N 7t02BBetTa7Rtk4QUiwscdoyH9SYa+eBe1iQOrg8wSZwbyapqZeRyjJLS13qIJFcwSBy Tr7Z9ZzEgE5Sk+/tR8rSdpqyX1F1QgTsIboS8/gCZKAc2jeN4NqFYglnsSPFL22C6bl1 6PRxqZw1t8dPE9wwc9Rc0dbOoLv1qtRWyy4DRNhKWFTEdq1oE3xrSUrYfijQbBeJSq43 ytXigak5fHU0nWNJA9g1/81deOU++6FzwjJrGLZdRbwMaGid/BqStfwil9LtPCREkPPe XQ0g== X-Gm-Message-State: APjAAAVHFbUyoH7fgYHBMtqDvHVaWKgwBuGuOvTGxD5g5V6IMTJ4bUY+ 7dFeDPtSbjheh54l+r/SUkxkmn4b X-Google-Smtp-Source: APXvYqydxe3G7Tu22J+apjp+5d5/PwhOdODQy7kgltlL1sgPYqZdk30Ve8K5vjMwdGBemMCZkGUZfQ== X-Received: by 2002:a05:6000:1111:: with SMTP id z17mr56632201wrw.103.1555500328040; Wed, 17 Apr 2019 04:25:28 -0700 (PDT) Received: from laptop.fritz.box ([2a02:908:1252:fb60:be8a:bd56:1f94:86e7]) by smtp.gmail.com with ESMTPSA id u189sm4215196wme.25.2019.04.17.04.25.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Apr 2019 04:25:27 -0700 (PDT) From: " =?utf-8?q?Christian_K=C3=B6nig?= " X-Google-Original-From: =?utf-8?q?Christian_K=C3=B6nig?= To: dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, airlied@linux.ie, emil.velikov@collabora.com, andresx7@gmail.com, keithp@keithp.com, Alexander.Deucher@amd.com Date: Wed, 17 Apr 2019 13:25:25 +0200 Message-Id: <20190417112525.16848-2-christian.koenig@amd.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190417112525.16848-1-christian.koenig@amd.com> References: <20190417112525.16848-1-christian.koenig@amd.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=ofyJS1XJHfP8cHGUS+SH0RuqxI7q3EciFASc2cwAjoA=; b=W9WIdoF1uNpwpsAIqELM2iQyt5keZAR0ICRaCv9BmE5rGTzE/eJpLp05Q+k6eyc63i plcd/Um+tGa6wGncvJ9146noYdy/RhWPrY+SI/n2SGHE/OY1TGDCOhlGlClAOV7H1ZV0 bYPv3MkbecQcjGAWr5f+VZBg/QfrI4RhzpNYHYx/BBPY9z3FROgH3U3WmZDuTVTDNAsb UMtz+6t+tZwtHKWXmWOFh9fBjGEPrSFecIA34rs1w6DE/tOrLttr5NbZPFfZ4gmR9qO2 5YF9MgxM9r3XFm1X/CAgSfDb4f2aMjQ3PptUal9M76ccw9QNdHw15gEZjntY5Hhv9Oqf ZEcw== Subject: [Intel-gfx] [PATCH 2/2] drm: revert "allow render capable master with DRM_AUTH ioctls" X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP This reverts commit 8059add0478e29cb641936011a8fcc9ce9fd80be. It's breaking radv and most likely old libdrm_amdgpu versions. Signed-off-by: Christian König --- drivers/gpu/drm/drm_ioctl.c | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c index d337f161909c..ce8a70875bd5 100644 --- a/drivers/gpu/drm/drm_ioctl.c +++ b/drivers/gpu/drm/drm_ioctl.c @@ -508,13 +508,6 @@ int drm_version(struct drm_device *dev, void *data, return err; } -static inline bool -drm_render_driver_and_ioctl(const struct drm_device *dev, u32 flags) -{ - return drm_core_check_feature(dev, DRIVER_RENDER) && - (flags & DRM_RENDER_ALLOW); -} - /** * drm_ioctl_permit - Check ioctl permissions against caller * @@ -529,19 +522,14 @@ drm_render_driver_and_ioctl(const struct drm_device *dev, u32 flags) */ int drm_ioctl_permit(u32 flags, struct drm_file *file_priv) { - const struct drm_device *dev = file_priv->minor->dev; - /* ROOT_ONLY is only for CAP_SYS_ADMIN */ if (unlikely((flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN))) return -EACCES; - /* AUTH is only for master ... */ - if (unlikely((flags & DRM_AUTH) && drm_is_primary_client(file_priv))) { - /* authenticated ones, or render capable on DRM_RENDER_ALLOW. */ - if (!file_priv->authenticated && - !drm_render_driver_and_ioctl(dev, flags)) - return -EACCES; - } + /* AUTH is only for authenticated or render client */ + if (unlikely((flags & DRM_AUTH) && !drm_is_render_client(file_priv) && + !file_priv->authenticated)) + return -EACCES; /* MASTER is only for master or control clients */ if (unlikely((flags & DRM_MASTER) &&