Message ID | 1461954105-5940-4-git-send-email-robert@sixbynine.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <intel-gfx-bounces@lists.freedesktop.org> X-Original-To: patchwork-intel-gfx@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 30595BF440 for <patchwork-intel-gfx@patchwork.kernel.org>; Fri, 29 Apr 2016 18:22:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5C86F201CE for <patchwork-intel-gfx@patchwork.kernel.org>; Fri, 29 Apr 2016 18:22:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 71859201E4 for <patchwork-intel-gfx@patchwork.kernel.org>; Fri, 29 Apr 2016 18:22:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7021E6E3FE; Fri, 29 Apr 2016 18:22:01 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4B8256E3FB; Fri, 29 Apr 2016 18:21:58 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id r12so6819423wme.0; Fri, 29 Apr 2016 11:21:58 -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=DzVvUjqkF9+crX0e1ltcgrlDbcCTvD1wBl6OtUuETZc=; b=uZMagIcEtZ2mf7dvYr8/kBOxkAWnWzM7/3WSppFP+pM0m2Ly0pAmnLOBwlCUpO7pzS m0OUgdg2nqMDpDJ00lXbx1YLMkGUxZDXI26J9LBC3KyeoFV1AycSj0XqhGzQiNGNJ3xw gT434JMcrxJ2AwefdmUNOTuGE0AQOJxalekDQOtH024T+LBjA8ZjJkiU1NBo+g2d4i8t YqWsk0z30XeT4ua4L+pHqqafpZAhfEPV4ccQGRzbFVmBapCA63+vmJk3KWh/GdLiFEAA g1/hUR4puFlaOPWHNSCgdiilZCJtf2WYU0ux0soKiiWCVnGiyIM7SSSVOtlu7A4dwnGA uVJQ== 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=DzVvUjqkF9+crX0e1ltcgrlDbcCTvD1wBl6OtUuETZc=; b=aeNaF8HHwSukVh+AL6qB8oJTW0Qx9N5i57XaVSuy4VBNeZEEMDJqseAzC3qlyQ9OVM IMuQpcjAeZJDBbzbc0ZnaYluTqtf4ldcb3EaDRBKyxzsVjrNNBxSjkbiv30U2UMwPksm fMqS8nqyjs8K0ZnBs9AOq/8IqBfWQVk7gXVxjeJrSsYNQl3NR/vnZm5UY/kQNtvfOm+w 8N9WZhCyB6+fcSZl9cTCwDlR4UrASrN3CT+klrC3YTT2J3rTF6EqIXn9UN+i9TxXaSi8 IwVrBhfimbKeXlEjs+8WDdv6J8DCEvusM5NY8hdD6t1OHLOzC2wYT5n/7GCUaCaQd+NK RXug== X-Gm-Message-State: AOPr4FWHZRyTd3hp4getpdmLSKkaKCvb+b1YhdC0RrnTUQXpjG1yk9HfdCiZMd4nm/a8Ew== X-Received: by 10.194.10.162 with SMTP id j2mr23179747wjb.72.1461954115888; Fri, 29 Apr 2016 11:21:55 -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 f8sm15986673wjm.13.2016.04.29.11.21.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Apr 2016 11:21:55 -0700 (PDT) From: Robert Bragg <robert@sixbynine.org> To: intel-gfx@lists.freedesktop.org Date: Fri, 29 Apr 2016 19:21:38 +0100 Message-Id: <1461954105-5940-4-git-send-email-robert@sixbynine.org> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1461954105-5940-1-git-send-email-robert@sixbynine.org> References: <1461954105-5940-1-git-send-email-robert@sixbynine.org> Cc: David Airlie <airlied@linux.ie>, dri-devel@lists.freedesktop.org, Sourab Gupta <sourab.gupta@intel.com>, Deepak S <deepak.s@intel.com>, Daniel Vetter <daniel.vetter@intel.com> Subject: [Intel-gfx] [PATCH v2 03/10] 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-Spam-Status: No, score=-5.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 035f2dd..5724d80 100644 --- a/drivers/gpu/drm/i915/i915_cmd_parser.c +++ b/drivers/gpu/drm/i915/i915_cmd_parser.c @@ -1245,7 +1245,7 @@ int i915_parse_cmds(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(-)