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) &&