Message ID | 20160818224241.2315-4-robert@sixbynine.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <intel-gfx-bounces@lists.freedesktop.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4A930607FF for <patchwork-intel-gfx@patchwork.kernel.org>; Thu, 18 Aug 2016 22:42:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F1F62929C for <patchwork-intel-gfx@patchwork.kernel.org>; Thu, 18 Aug 2016 22:42:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33AD6292BC; Thu, 18 Aug 2016 22:42:52 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 EC74F2929C for <patchwork-intel-gfx@patchwork.kernel.org>; Thu, 18 Aug 2016 22:42:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B258A6EB48; Thu, 18 Aug 2016 22:42:49 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2634C6EB44; Thu, 18 Aug 2016 22:42:48 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id i138so1312111wmf.3; Thu, 18 Aug 2016 15:42:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=1cvK8TRHnSjqFmSA9AVA+kY0GsrtkSHzsDSp/bYa9ws=; b=Ru5RPz72K/OXaFnl4UY0v26JXc9Onrpw9dXwBbGCjL4gdJglN22aRyU4SIFS6tbGmF 1NngS8OLP3PuvM8ls9aiXpjIfR3VflN/icpeUBJstYsiL1r7e9t60BgdX5R1kvZnSKvM x57wZ8aYxWbhpsoc9+O9bo5e9CGTOVwvwWR/H/F5VUYPAd/lYvBNhgtAhbs3M8hlI2Kh F+nVoXi6L3qP0ytD0V4raiLSuMOv2Bs8wzdWVFuQt7G69uS3PGoxs6+TsN8LMGMio8RI f11Q1WPjya7GqQf0skC71ypDx+qb0BCn9YHi8MvpGbDqomIv2gS6zRKHrG+WfyKvDppo owKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=1cvK8TRHnSjqFmSA9AVA+kY0GsrtkSHzsDSp/bYa9ws=; b=d8aRPWLEzQj4xcOAcgGcy2HQaNDnee6Ac0kzuz6phqdmTkrYYC9DDuo7YQzqHs0S1e I3q4oSzVO62G8OdeVSgV0e+H/qyFauCZGuxzx+3X5zRmbwD0kJjvJILbdc+scPA3Qq6G WaqUUdLF6q6OsyUqfzPa5ckQuad+gF/oJ2gj4MGXG9RU9/M2k78Kh2Q66ca+A2c0BQib ctsOETflKri6T2tHwCGPW/djIziV4cdBkb7Z9xJioWqkkeHYZ7bS5dAwzYgowwAmeuNL 5y5jdib7f/6MMGni+jiZovs5s9oUtZhaD5fx0Zfw6ivf3/OXlCeko4CCWwAFILrnI0XX 66yA== X-Gm-Message-State: AEkooutdMM12tvwUcNoVGXjBVEoTbi6E1M1Hwt4B8nDKO3fBeXOGnj8L1QBWla6uANkQvg== X-Received: by 10.194.88.137 with SMTP id bg9mr3706888wjb.155.1471560166777; Thu, 18 Aug 2016 15:42:46 -0700 (PDT) Received: from sixbynine.org (cpc26-heme10-2-0-cust305.9-1.cable.virginm.net. [86.3.57.50]) by smtp.gmail.com with ESMTPSA id bc10sm4195793wjc.32.2016.08.18.15.42.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 18 Aug 2016 15:42:46 -0700 (PDT) From: Robert Bragg <robert@sixbynine.org> To: intel-gfx@lists.freedesktop.org Date: Thu, 18 Aug 2016 23:42:33 +0100 Message-Id: <20160818224241.2315-4-robert@sixbynine.org> X-Mailer: git-send-email 2.9.2 In-Reply-To: <20160818224241.2315-1-robert@sixbynine.org> References: <20160818224241.2315-1-robert@sixbynine.org> Cc: David Airlie <airlied@linux.ie>, dri-devel@lists.freedesktop.org, Sourab Gupta <sourab.gupta@intel.com>, Daniel Vetter <daniel.vetter@intel.com> Subject: [Intel-gfx] [PATCH v4 03/11] drm/i915: return EACCES for check_cmd() failures X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development <intel-gfx.lists.freedesktop.org> List-Unsubscribe: <https://lists.freedesktop.org/mailman/options/intel-gfx>, <mailto:intel-gfx-request@lists.freedesktop.org?subject=unsubscribe> List-Archive: <https://lists.freedesktop.org/archives/intel-gfx> List-Post: <mailto:intel-gfx@lists.freedesktop.org> List-Help: <mailto:intel-gfx-request@lists.freedesktop.org?subject=help> List-Subscribe: <https://lists.freedesktop.org/mailman/listinfo/intel-gfx>, <mailto:intel-gfx-request@lists.freedesktop.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" <intel-gfx-bounces@lists.freedesktop.org> X-Virus-Scanned: ClamAV using ClamSMTP |
diff --git a/drivers/gpu/drm/i915/i915_cmd_parser.c b/drivers/gpu/drm/i915/i915_cmd_parser.c index cfe3e7a..71e778b 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -1261,7 +1261,7 @@ int intel_engine_cmd_parser(struct intel_engine_cs *engine, if (!check_cmd(engine, desc, cmd, length, is_master, &oacontrol_set)) { - ret = -EINVAL; + ret = -EACCES; break; }
check_cmd() is checking whether a command adheres to certain restrictions that ensure it's safe to execute within a privileged batch buffer. Returning false implies a privilege problem, not that the command is invalid. The distinction makes the difference between allowing the buffer to be executed as an unprivileged batch buffer or returning an EINVAL error to userspace without executing anything. In a case where userspace may want to test whether it can successfully write to a register that needs privileges the distinction may be important and an EINVAL error may be considered fatal. In particular this is currently true for Mesa, which includes a test for whether OACONTROL can be written too, but Mesa treats any error when flushing a batch buffer as fatal, calling exit(1). As it is currently Mesa can gracefully handle a failure to write to OACONTROL if the command parser is disabled, but if we were to remove OACONTROL from the parser's whitelist then the returned EINVAL would break Mesa applications as they attempt an OACONTROL write. Signed-off-by: Robert Bragg <robert@sixbynine.org> --- drivers/gpu/drm/i915/i915_cmd_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)