From patchwork Tue Feb 23 15:51:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Roberts X-Patchwork-Id: 12100517 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D767EC433E0 for ; Tue, 23 Feb 2021 15:52:00 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 788F364E20 for ; Tue, 23 Feb 2021 15:51:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 788F364E20 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=igalia.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D33556E9D9; Tue, 23 Feb 2021 15:51:57 +0000 (UTC) Received: from fanzine.igalia.com (fanzine.igalia.com [178.60.130.6]) by gabe.freedesktop.org (Postfix) with ESMTPS id DA2D26E9D9 for ; Tue, 23 Feb 2021 15:51:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject:Cc:To:From; bh=kSsqliwiyWRvBbbZMCGSMXgrO6gyXnCzInEaxK+Cxb8=; b=WE4jxzUrSq4glcaS2PeZge1u8jm0EbQq6DFCkzkNhwvYMW7WZx56cUoHc+XJWjFZPJt6h7qzBEoPT7bndMZs5uUFXFO17S1YmXO4nrRMKXadgIo+O8/pheqRZx3kvoxSoLxKRxXUp66hObvmnSx4QdYWoK67hE/pDe53oc8wMCOR/SP2aLJGXI27zNH4KiDXaV62v9NtHM9P/ndUFbih2eKrpekWsx5p65omMaTTwpwyT1vF8+okH/KzP6d1vTaE78f7swnHM8UIzsGt5R9efUrj9b/js9poWn7PdJCoQ27JG2vv2NTmwTaXJf8UXEF7nc6eA7yWZjldudA3CTPHiw==; Received: from lneuilly-657-1-8-171.w81-250.abo.wanadoo.fr ([81.250.147.171] helo=masxo.routerf36dc8.com) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1lEZyZ-00036t-4o; Tue, 23 Feb 2021 16:51:51 +0100 From: Neil Roberts To: Rob Herring , Tomeu Vizoso , Alyssa Rosenzweig , Steven Price , Robin Murphy Subject: [PATCH 0/2] Fix purging buffers in the shmem helpers Date: Tue, 23 Feb 2021 16:51:23 +0100 Message-Id: <20210223155125.199577-1-nroberts@igalia.com> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" These two patches fix a problem with the madvise purging code for the shmem helpers where the mmaping for a purged buffer wouldn't get invalidated correctly. This presumably ends up as a security hole where the mapping can be accessed from user-space to read and write random pages from other buffers. This is currently affecting Panfrost. The second patch is a v2 from a patch that was sent standalone. There is a WIP IGT test for Panfrost which demonstrates the bug here: https://gitlab.freedesktop.org/nroberts/igt-gpu-tools/-/commits/panfrost-purgemap/ Neil Roberts (2): drm/shmem-helper: Check for purged buffers in fault handler drm/shmem-helper: Don't remove the offset in vm_area_struct pgoff drivers/gpu/drm/drm_gem_shmem_helper.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-)