From patchwork Mon Jul 22 17:40:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Emil Velikov X-Patchwork-Id: 11053201 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 9103B13AC for ; Mon, 22 Jul 2019 17:40:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7FF36285C8 for ; Mon, 22 Jul 2019 17:40:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71AE0285CD; Mon, 22 Jul 2019 17:40:55 +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 2448F285C8 for ; Mon, 22 Jul 2019 17:40:55 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4729289D67; Mon, 22 Jul 2019 17:40:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@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 D357189D66 for ; Mon, 22 Jul 2019 17:40:46 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id r1so40295166wrl.7 for ; Mon, 22 Jul 2019 10:40:46 -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=2eEadTDICSV2Qk9KPFsrvesCyzVBF6U7MCfRL010Yfg=; b=jsxK10yYxjwDWHjyAfiengBL4wS/goYq4C017k6W3h2X6fp/DlXGmpiDQp6PJUwxEU z0hnMX+5lLwpe8lwA1GYqdabDERgxCsO+0lTVvo9uD3WB2rQhuyTDiZkQkyNzTwImIEQ qNru45Eae9R37SE3X2jaLDtiEmjxzZMX3e/k2X0iZ7jmkFw/cj2LiXF7ESQckQM95fTV yMUjo57qKeDUUK9gaYEjvV+ZmgeFLfIa2qHMNl9HqPln0nFxknpsrRJUvdcVHz63L5uM 0CdXLBMlhk7HeDEPsRxjmxL6dH0OZOsq2BHtCwZRAS+PTYnrKt/ASzwJdzPADbXjc9gP UwBA== X-Gm-Message-State: APjAAAXJl5lDVubRxS0tVbw+JEIQ2uFBKV+M1sNi2Heu/35VYXe6qbwH r5N472T1H86TKWV0o50ctQQhwYLY X-Google-Smtp-Source: APXvYqzsYe1fiNN5Y+OBY9yE/3oilj5VIwYccdEACEOkoMKiJ/WUtBQxKfofJUuWjIgkbnvRMMqtsQ== X-Received: by 2002:adf:f042:: with SMTP id t2mr75332033wro.139.1563817245275; Mon, 22 Jul 2019 10:40:45 -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 b2sm51844663wrp.72.2019.07.22.10.40.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 22 Jul 2019 10:40:44 -0700 (PDT) From: Emil Velikov To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/3] drm/vmwgfx: add local DRM_AUTH check for PRIME TO/FROM HANDLE Date: Mon, 22 Jul 2019 18:40:24 +0100 Message-Id: <20190722174025.9830-2-emil.l.velikov@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190722174025.9830-1-emil.l.velikov@gmail.com> References: <20190722174025.9830-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=2eEadTDICSV2Qk9KPFsrvesCyzVBF6U7MCfRL010Yfg=; b=r1x46qxMy+B7s22f/bJBQqPHRXfsswbsLgZ4t+dP6XggTg6i8nL07kMhlZ+ranmj2L ut+gvP2eZEUXXETYkojH/qBZaHisMUmIMPcPMsQMMsgs1LpwhGw7RWW7jhcFBwVTQkFZ dt+z7EPUU1C13/u1sdh3zWP1/p9pmr5NM7AZ5Lv20/Pzj76QM1Ohs3MdGuoho/WToGEy W0O39PA5udyYNFVuafDyApoSWb7ICFGSydts62Y7OVR7bV51I/QimAXfWqoVGh63Naus Kzi2aJ9ek2rW806MPgy5ErjDwexKk68HyHZgMxkqBbRudzWQWJzdMkHIjhm5e4hauarN mrvw== 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: VMware Graphics , Thomas Hellstrom , emil.l.velikov@gmail.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Emil Velikov Realistically no drivers, but vmwgfx care about the DRM_AUTH flag here. Follow-up work in this driver will properly isolate primary clients from different master realms, thus we'll no longer need to parse _any_ ioctl flags. Until that work lands, add a local workaround. Cc: VMware Graphics Cc: Thomas Hellstrom Signed-off-by: Emil Velikov --- I'd like to merge this through the drm-misc tree. Ack and rb are appreciated. Thanks Emil --- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c index 275d90fe2a25..32c18bb482a6 100644 --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c @@ -1131,6 +1131,15 @@ static long vmw_generic_ioctl(struct file *filp, unsigned int cmd, } else if (!drm_ioctl_flags(nr, &flags)) return -EINVAL; + /* + * Little workaround until the vmwgfx patches providing isolation of + * primary clients from different master realms lands. + * With that work, we'll no longer need to parse _any_ ioctl flags. + */ + if (nr == 0x2d /* DRM_IOCTL_PRIME_HANDLE_TO_FD */ || + nr == 0x2e /* DRM_IOCTL_PRIME_FD_TO_HANDLE */) + flags != DRM_AUTH; + vmaster = vmw_master_check(dev, file_priv, flags); if (IS_ERR(vmaster)) { ret = PTR_ERR(vmaster);