From patchwork Wed Jun 14 23:18:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 9787757 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 79584602CB for ; Thu, 15 Jun 2017 00:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6EDF7284DC for ; Thu, 15 Jun 2017 00:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 637A4284ED; Thu, 15 Jun 2017 00:59:46 +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 1EB19284DC for ; Thu, 15 Jun 2017 00:59:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7ACE36E696; Thu, 15 Jun 2017 00:57:46 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 57C676E639 for ; Wed, 14 Jun 2017 23:19:09 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id o28so1618551lfk.1 for ; Wed, 14 Jun 2017 16:19:09 -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=oLrJNqvLV99lefUIaiNga/PR20mKXJqQM0jTkRLPsu4=; b=cXa5ycwsU3DmBB96b7dz1+7xAiatCDIxQMC0c2iLXw+njDP/RTVB4ktB2lupO10F5l 9aAUmgi3V6kAbSi1KXUQkp/VIvJPeqg7DYEvii7gLPOwpeRf8K7AtDXDRCXJalXWuTqa MmvSnmc2TWMXM+8YWIdPeHWpNEWp+WheuObmvItCl/6RnE43zY7Ggqjfq/QKSl/sE5ih 88rlX3b9minKaInnJPAq71gWjwRNnACWkchBoImx8JsLSMOHLMbZfwjDlGimHlQxDU2P 2MgCD3ZL9sJx+INdnwT7+6ekgxmt98+2PRWRezEUoNLRiTCRWyH/GegmTm3jTPj317w+ Ty0Q== 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=oLrJNqvLV99lefUIaiNga/PR20mKXJqQM0jTkRLPsu4=; b=pVy+Ai+s5cTnw1MDkJLy4l9Ivro69D+UXnblNfJmklH00eCRuBV8vb/F/uthTywAbp YkEDXxAHahVw+pkQYLw0ySTvFHnJ3AqbMUzI6hHPOSDHA6ucaQCZX6OutgZm2pi1pTwi FgjSK4r4wQylYSMOIO8Dx/Q5ls4cv8kqjHHwfkiNcYbqWbZFJmGBNzCujEWIkEzvBvgl djbWp6idREmwW+zm2yFOBlofW0skTNkxkgcyEREDUarE48cJ22bSmXlCn/df9Wd6GLnm HzR4cr18zfcehaDcSFAcFkkW6OZ7NBOTsAszgQKhHfy2MVtaAA1wnYf1nQnku1nAiorN 3SmQ== X-Gm-Message-State: AKS2vOyFyrz+3Ugyvao9YPcji9EjPSZEcypC3bPW3srjsB9MQwKe2pk9 W6KqIWQ+kojPnA== X-Received: by 10.25.18.23 with SMTP id h23mr759551lfi.0.1497482347842; Wed, 14 Jun 2017 16:19:07 -0700 (PDT) Received: from localhost.localdomain (ppp109-252-91-7.pppoe.spdop.ru. [109.252.91.7]) by smtp.gmail.com with ESMTPSA id i24sm290165ljb.63.2017.06.14.16.19.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Jun 2017 16:19:07 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Mikko Perttunen , Erik Faye-Lund Subject: [PATCH v3 12/20] gpu: host1x: Forbid relocation address shifting in the firewall Date: Thu, 15 Jun 2017 02:18:35 +0300 Message-Id: X-Mailer: git-send-email 2.13.0 In-Reply-To: References: In-Reply-To: References: X-Mailman-Approved-At: Thu, 15 Jun 2017 00:57:20 +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 absence. As of now, there is no known use for the address shifting and adding a proper shifts / sizes validation is a much more work. Let's forbid shifts in the firewall till a proper validation is implemented. Signed-off-by: Dmitry Osipenko Reviewed-by: Erik Faye-Lund 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 4208329ca2af..a911de6386b4 100644 --- a/drivers/gpu/host1x/job.c +++ b/drivers/gpu/host1x/job.c @@ -330,6 +330,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; }