Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2922481pxb; Tue, 24 Aug 2021 10:40:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzDlj70SIpD+oavcirgVCDUx3DZoVvtXABh8rsjOX7J//VF6CMxLf2hsxTRFt/FdECZkTcn X-Received: by 2002:a5e:9602:: with SMTP id a2mr32963793ioq.146.1629826826781; Tue, 24 Aug 2021 10:40:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629826826; cv=none; d=google.com; s=arc-20160816; b=UWndfkUN29q2X14cBGrP9tqlZMifQY3H2vIjWXeygOksXqhquGz6QzQg8ZJVrUfo+v F9W4UANWb/Bcy7pLFe4bqdTT6+rmU0WnQtKbbTExGWXv2uQMzheWpAFINJNASaLUbfGO syRYnKIPzZ63PVC7DXy4X0bPYTs5iyGOUtyquec8m0ClSlpetCrJ8l68IvysFpQkiytJ Uzv4aR2+5P7xwWqDgYC5raga3ST5zdgiMx388AMYmMp8WPoy/xgIcYwsvkc9v4Gfnl/M z4s1DZ+QFDI7DuV5rQuHaGl335Za8hReIA3K8QE3G67Q4wIMMmi3RvVP/07v74HbNMGi zqiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-language:content-transfer-encoding :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=C1fbyk5NjIcjfmrgRQNl/t/TXD+9nQE/LMXX6Nk+jrs=; b=QioRGSPEbSW37fxa9bpt2uzT2CaY8U5JSspTa1OaPUI3aeObUKBnd+RkTpcfpk+eFZ iFhTSF/d5O74tkQPL2BoxE+j/Op/1Fwgh/J689GuXdz9OuDBjgKs1RMPRbvHyjAsrqTR F+Y9cd45m40ZgGAQN0z1sZChdIRfGFVckcfTYZUZsiMojSUWlVtaR1YXuRtnHknK+US4 ah2f61PO5h/bhQ/O+QxOuuYlkDWpBDiICdHJn9lX0LK9qcEA/DSdy43gci7vzEWwoVtN ZoUVGuvtuFOuuFdP0vt6D8mSIPil81jpnthDDw9mmGsa1hCrtBU4FmyeFYwBtx5QkEiZ h9Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r6si18093120ilb.145.2021.08.24.10.40.15; Tue, 24 Aug 2021 10:40:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242505AbhHXRjX (ORCPT + 99 others); Tue, 24 Aug 2021 13:39:23 -0400 Received: from mga14.intel.com ([192.55.52.115]:6871 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241623AbhHXRgi (ORCPT ); Tue, 24 Aug 2021 13:36:38 -0400 X-IronPort-AV: E=McAfee;i="6200,9189,10086"; a="217083349" X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="217083349" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 10:20:48 -0700 X-IronPort-AV: E=Sophos;i="5.84,347,1620716400"; d="scan'208";a="526704367" Received: from akleen-mobl1.amr.corp.intel.com (HELO [10.209.119.65]) ([10.209.119.65]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Aug 2021 10:20:46 -0700 Subject: Re: [PATCH v4 11/15] pci: Add pci_iomap_shared{,_range} To: "Michael S. Tsirkin" Cc: Dan Williams , "Kuppuswamy, Sathyanarayanan" , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Bjorn Helgaas , Richard Henderson , Thomas Bogendoerfer , James E J Bottomley , Helge Deller , "David S . Miller" , Arnd Bergmann , Jonathan Corbet , Peter H Anvin , Dave Hansen , Tony Luck , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , X86 ML , Linux Kernel Mailing List , Linux PCI , linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch , Linux Doc Mailing List , virtualization@lists.linux-foundation.org References: <20210805005218.2912076-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20210805005218.2912076-12-sathyanarayanan.kuppuswamy@linux.intel.com> <20210823195409-mutt-send-email-mst@kernel.org> <26a3cce5-ddf7-cbe6-a41e-58a2aea48f78@linux.intel.com> <20210824053830-mutt-send-email-mst@kernel.org> From: Andi Kleen Message-ID: Date: Tue, 24 Aug 2021 10:20:44 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20210824053830-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > I see. Hmm. It's a bit of a random thing to do it at the map time > though. E.g. DMA is all handled transparently behind the DMA API. > Hardening is much more than just replacing map with map_shared > and I suspect what you will end up with is basically > vendors replacing map with map shared to make things work > for their users and washing their hands. That concept exists too. There is a separate allow list for the drivers. So just adding shared to a driver is not enough, until it's also added to the allowlist Users can of course chose to disable the allowlist, but they need to understand the security implications. > > I would say an explicit flag in the driver that says "hardened" > and refusing to init a non hardened one would be better. We have that too (that's the device filtering) But the problem is that device filtering just stops the probe functions, not the initcalls, and lot of legacy drivers do MMIO interactions before going into probe. In some cases it's unavoidable because of the device doesn't have a separate enumeration mechanism it needs some kind of probing to even check for its existence And since we don't want to change all of them it's far safer to make the ioremap opt-in. -Andi