From patchwork Wed Jul 3 13:31:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 11029635 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 950DE138B for ; Wed, 3 Jul 2019 13:31:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 866A828971 for ; Wed, 3 Jul 2019 13:31:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 78AA728972; Wed, 3 Jul 2019 13:31:01 +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 EC625287F5 for ; Wed, 3 Jul 2019 13:31:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4B3F26E136; Wed, 3 Jul 2019 13:30:57 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) by gabe.freedesktop.org (Postfix) with ESMTPS id 123C86E136; Wed, 3 Jul 2019 13:30:55 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id w9so2944655wmd.1; Wed, 03 Jul 2019 06:30:54 -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:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CB20BQLa7LUdpzL0jXGqCFr7P5662ND8QYXbpIWuARc=; b=kdmfvb8DW8Ue+nCEf5Ra+6L9wBYbyRlZlCwRQiov+htewgaujjh+IwsrPbSvygcsUl 2nGUcMrvrcBuUKhIb+wn6leROFhuzuc/rPQnOPuXkiobpIp7zwADmteaJbRGJuILXkhv 9gS7kfZGKvAP3rbL9kKCbXNajbt4ZPC4X6IccwB72M/ttUl2cR8tRxmbMmw19ri7CRKb HrvjnAdOy9DXnnGIttzKrlXiD0INrD1OYIKwJ5NSdQVhXheCj3nwHnm2nr4LUgi+xfAU TswiDLbE4ALwNIGy8ahvyWk4jrvTNAdM8JY1aJKlO4QQ+snLll/Bi/Q7dpwXUFZLas/q pkXg== X-Gm-Message-State: APjAAAWAffgL3tKC223cgy9n42AH5GFGp/n1pRtwt1DH5RqO7kqDi6tp Sk8fYUOIKFuBARyory0CtqDdGNfe X-Google-Smtp-Source: APXvYqxy1LfHhDHXnFtbg+8QrAUFj+Ke0v4HBf1Z8gupKx38qc9WeQXbhB2xdpSxplKn/TYnUtBiLg== X-Received: by 2002:a1c:ca14:: with SMTP id a20mr7831368wmg.71.1562160653300; Wed, 03 Jul 2019 06:30:53 -0700 (PDT) Received: from arch-x1c3.cbg.collabora.co.uk ([2a00:5f00:102:0:9665:9cff:feee:aa4d]) by smtp.gmail.com with ESMTPSA id g10sm2353263wrw.60.2019.07.03.06.30.52 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Wed, 03 Jul 2019 06:30:52 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm: introduce DRIVER_FORCE_AUTH Date: Wed, 3 Jul 2019 14:31:03 +0100 Message-Id: <20190703133104.3211-2-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190703133104.3211-1-emil.l.velikov@gmail.com> References: <20190703133104.3211-1-emil.l.velikov@gmail.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:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CB20BQLa7LUdpzL0jXGqCFr7P5662ND8QYXbpIWuARc=; b=CwwdJr+KuSl2dP1YTJfeexPqxT7SiGfMzu5uGrkY9sbuQph6vQdjERMaJ6MsF/pZQ7 hZh4Bll5n+2m4bRdIVQr/jCkK0Emi6FoiwHEEBkbZxBEyDCJXAynvZmB/f7VpZ90CwJF /Mzv+wJ837HA5ZXW8ogEgOg7Hiro9CUHxSXAovqmn6RjdX0/pULGhUcbbeuJ9N1b5IYu /M6LFYeGgbf/BEh6ajVLNyuDRyNROme2dkrg8w4DQg/CqjLS6o5t8UmJEPEqoEQPkS/N 4KOXLVMJoREgg5K0tHfapJa7P2jLJb6Sd6fWDNymXXD5f3nL+T2ES95aPCmi/POHzqHz EiqQ== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Deucher , emil.l.velikov@gmail.com, =?utf-8?q?Christian_K=C3=B6nig?= , amd-gfx@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov With earlier commits we've removed DRM_AUTH for driver ioctls annotated with DRM_AUTH | DRM_RENDER_ALLOW, as the protection it introduces is effectively not existent. With next commit, we'll effectively do the same for DRM core. Yet the AMD developers have voiced concerns that by doing so, developers working on the closed source user-space driver might remove render node support. Since we do _not_ want that to happen, add workaround for those two drivers Cc: Alex Deucher Cc: Christian König Cc: amd-gfx@lists.freedesktop.org Cc: Daniel Vetter Signed-off-by: Emil Velikov Signed-off-by: Emil Velikov --- Christian, Alex this is the cleaner way to handle AMDGPU/radeon although if you prefer alternative methods let me know. Review, acks and others are appreciated, since I'd like to get this through the drm-misc tree. Thanks Emil Unrelated: The USE_AGP flag in AMDGPU should be nuked. While for radeon, one can copy in the driver the 10-20 lines worth of agp_init/release and also drop the flag. Bonus points of agp_init code gets a LEGACY check alongside the USE_AGP one. --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +- drivers/gpu/drm/radeon/radeon_drv.c | 2 +- include/drm/drm_drv.h | 10 ++++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 8e1b269351e8..cfc2ef11330c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -1307,7 +1307,7 @@ amdgpu_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe, static struct drm_driver kms_driver = { .driver_features = - DRIVER_USE_AGP | DRIVER_ATOMIC | + DRIVER_USE_AGP | DRIVER_ATOMIC | DRIVER_FORCE_AUTH | DRIVER_GEM | DRIVER_RENDER | DRIVER_MODESET | DRIVER_SYNCOBJ, .load = amdgpu_driver_load_kms, diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c index 4403e76e1ae0..5a1bfad1ad5e 100644 --- a/drivers/gpu/drm/radeon/radeon_drv.c +++ b/drivers/gpu/drm/radeon/radeon_drv.c @@ -538,7 +538,7 @@ radeon_get_crtc_scanout_position(struct drm_device *dev, unsigned int pipe, static struct drm_driver kms_driver = { .driver_features = - DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER, + DRIVER_USE_AGP | DRIVER_GEM | DRIVER_RENDER | DRIVER_FORCE_AUTH, .load = radeon_driver_load_kms, .open = radeon_driver_open_kms, .postclose = radeon_driver_postclose_kms, diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h index b33f2cee2099..5fb2846396bc 100644 --- a/include/drm/drm_drv.h +++ b/include/drm/drm_drv.h @@ -92,6 +92,16 @@ enum drm_driver_feature { * synchronization of command submission. */ DRIVER_SYNCOBJ_TIMELINE = BIT(6), + /** + * @DRIVER_FORCE_AUTH: + * + * Driver mandates that DRM_AUTH is honoured, even if the same ioctl + * is exposed via the render node - aka any of an "authentication" is + * a fallacy. + * + * Used only by amdgpu and radeon. Do not use. + */ + DRIVER_FORCE_AUTH = BIT(7), /* IMPORTANT: Below are all the legacy flags, add new ones above. */