From patchwork Tue May 23 00:14:29 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9741649 Return-Path: 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 C6CEC60210 for ; Tue, 23 May 2017 01:01:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC00B286EC for ; Tue, 23 May 2017 01:01:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0E5328779; Tue, 23 May 2017 01:01:37 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 5D0BA286EC for ; Tue, 23 May 2017 01:01:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C90046E2DE; Tue, 23 May 2017 01:00:11 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0C6516E08E for ; Tue, 23 May 2017 00:15:30 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id h4so6681388lfj.3 for ; Mon, 22 May 2017 17:15:29 -0700 (PDT) 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 :in-reply-to:references; bh=aAyoV0mOAveC70ucRd6FjOb6rJKUZmvLDPW60BYA2F8=; b=XBcq153db0grui4aFO5d4BursbmgbwJiOqnDwF0YksOG+/sVCAdd+6zdByaw61c1NM po3OOMyMAqRFt7Xxa+e/Y72F763oqggsLHIUSrW1LibsAHbbz4Vz+sxsXJ0AecR2AVs9 zYNOGIvCGe8p8T6LZDwP5z+0Kyj3A8UoEXoAGPHq0viyro8UYsAmraGcxiWTlw9R2gwo L1pohl4ccZooxHGowcdIOK3TPgrSzpIH4IxlorGpHtnm6qvak/CR7cYHsoVPkQJLWO5B +YrCZTa+uTzy6kPq+sB3xBcrPq55HNEyud170AsHZYo6lw7ee2uDCO4SPhQbp0vkj84x Pgzg== 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:in-reply-to:references; bh=aAyoV0mOAveC70ucRd6FjOb6rJKUZmvLDPW60BYA2F8=; b=Oy6p8hKEyCwF5Nj0vWoR+ep3yikfh7HnuW7/nFzLhNHWo1PgRADw+vHMQHkn6Y3ccT kg7rVdOrLoiexXHulYuRax1u7gdQ2Anr4xMca/cfc6jodm6cIBZCcCrttVeAdEe4Qz2H /6pCeNWJ8sbQCh8xPtPZXKztyJtQC9m/MWdX7Zw9Jyymg+n3h0wUXt2JhFdCXdd9eQJm cmQca7ab0XQLkKw2r/yuEaDoJCz7B7RMSWrbsUt8e1qci36cgvLTGcaPgyt53CxbzSeh NUeDjTe08GYX3tSZxJzNkl6dR09Opb0Ab4bm9mjS6g7c++agmFJUWH99NoNNqfHo+yaR OW5g== X-Gm-Message-State: AODbwcBTiYsgVY2aD+LCgkCrCELoqv4V9Nswis7ZRmFVQtStEt1mY1p5 7bUhOC1IXbp0vQ== X-Received: by 10.46.88.17 with SMTP id m17mr6639419ljb.26.1495498528494; Mon, 22 May 2017 17:15:28 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-175.pppoe.spdop.ru. [109.252.91.175]) by smtp.gmail.com with ESMTPSA id v30sm3440904ljd.9.2017.05.22.17.15.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 22 May 2017 17:15:27 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen Subject: [PATCH 14/22] gpu: host1x: Forbid relocation address shifting in the firewall Date: Tue, 23 May 2017 03:14:29 +0300 Message-Id: <15311f1c044c3ff26624e2a980b0c477b1cf33b2.1495498184.git.digetx@gmail.com> X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Tue, 23 May 2017 00:59:38 +0000 Cc: linux-tegra@vger.kernel.org, DRI Development X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Incorrectly shifted relocation address will cause a lower memory corruption and likely a hang on a write or a read of an arbitrary data in case of IOMMU absent. As of now there is no use for the address shifting (at least on Tegra20) and adding a proper shifting / sizes validation is much more work. Let's forbid it in the firewall till a proper validation is implemented. Signed-off-by: Dmitry Osipenko Reviewed-by: Mikko Perttunen --- drivers/gpu/host1x/job.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/gpu/host1x/job.c b/drivers/gpu/host1x/job.c index 190353944d23..1a1568e64ba8 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -332,6 +332,10 @@ static bool check_reloc(struct host1x_reloc *reloc, struct host1x_bo *cmdbuf, if (reloc->cmdbuf.bo != cmdbuf || reloc->cmdbuf.offset != offset) return false; + /* relocation shift value validation isn't implemented yet */ + if (reloc->shift) + return false; + return true; }