Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1608072pxb; Mon, 11 Oct 2021 09:23:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxPp0rddiIuGYmwZcRN9FyRd2BL1/ihzcA2ASoOo22te/JeezYAJG0f05d8EJqv/VK3DGOl X-Received: by 2002:a17:906:ca18:: with SMTP id jt24mr26740359ejb.325.1633969400209; Mon, 11 Oct 2021 09:23:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969400; cv=none; d=google.com; s=arc-20160816; b=HHygw+t/iOWStfl6EpxPSoDPcVk34nWQrxWNEk7OJk3/2fNJsW44X0TTihv8mm2/ws Hbruu4epPYFUQjhLkomiUXLtP64vNfWrrtshs1g4traIOGb1RDJeFUW7SsxXA0lWfoxK s5pcIRmgRfzdu/jskSWLdijm4a7NKVzDmm78t1/nQUxUDx0j9iSbgDhvp0c76i9lgET5 8tnM8TY8ifQJkUlVZJe6NtaDVY1pTpzDXUMJXosfTemmIou80wEv2kHUxd477nxm965R NNwgRndM0NFM4x6qtKWHQF7MYvdfkyBnnZYz/8yhkEz9nlrPtG8J10T4fcgLRLjMVekg qCcA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hwUIXMwF5ZMBaAs7PCxNKL8UZk5q2glV6KYJyh2b2Q4=; b=KaV6ousF53Z1efK4/Ydwp4nZ1cCUBHyQ6Rciked/wTTRqUidptqja62qhxWDpOB0Df JlcjjD7Q6QVpSQe//FbYu8xlmHpZpZ+ukS9bBCPHb8EtNXW0K2bniuJCNrWXYJ5LNtgk 9y41BMCRFk1QyFpTZoUx4xWsyU+z2U6mhkmXvG4ILQGMYxBLhxXkM30s/q7M3v+zmZY0 Bw6FWWiuOO6tXuVK4pL/dYZw7uz4f6sH/9sTiXYllbOaVKdcdVM0gw+YAmaC43i410/j 6VK4m0swpK5YsRbtTeHjLf8eaSG5yGYD9A8wuWVW4CmNhcp/4P5zjYqyUuBzu9GuzTio 9RbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WSQukelT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si11386474edh.518.2021.10.11.09.22.55; Mon, 11 Oct 2021 09:23:20 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=WSQukelT; 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=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234653AbhJKMB6 (ORCPT + 99 others); Mon, 11 Oct 2021 08:01:58 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:26590 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236045AbhJKMB5 (ORCPT ); Mon, 11 Oct 2021 08:01:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633953597; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hwUIXMwF5ZMBaAs7PCxNKL8UZk5q2glV6KYJyh2b2Q4=; b=WSQukelTmKdtW4e8dVO4rBrkyOGQWO3Gk+teXh23DW3jHemasuuFgdsZGRzmnKMlB+tKvZ vIUXknHm9VJCeQGRpSvZnkXsbOff7IeVJrUgNcShJr14aEViJUj/UIMQpwM7XMpVnqsU0r mcEmWebzHmzFNsBkH6NmZWH4sqxwlok= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-228-fNAxKb3dNgqjiE6dIgpKfg-1; Mon, 11 Oct 2021 07:59:25 -0400 X-MC-Unique: fNAxKb3dNgqjiE6dIgpKfg-1 Received: by mail-ed1-f72.google.com with SMTP id p13-20020a056402044d00b003db3256e4f2so15751270edw.3 for ; Mon, 11 Oct 2021 04:59:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=hwUIXMwF5ZMBaAs7PCxNKL8UZk5q2glV6KYJyh2b2Q4=; b=KdvHQtLIekqTvpAUkRMOHPJvJelGGvp62Ya5ji/Lq7m5X9g6AtTiNAdW/XG0z/YHrS JDI2PtTEXhpmP5yQpMkYnyz12ixRMsBDeyi2JU+udzjmD8Z+MXUwQFrJnnem2d/5nMhK hooGv9yssnva3iEEAnovbH/GLrLDvCWM1wBPpGvvOwNDd4nWGUw/mGh5StZNcBpqBpMd SXlAumHDTIfGXilBP235LAZUQdyW2EebNPvDW0ld2+dcEq7zyVjDRm8lFHvkSXFxcjLz yTdnAfh7WwiVOd9168Xbo3abK4h7TEozp5QofKf/hQR5n8D7JzJt5Vvb6/HJZCgF9pPS v4GA== X-Gm-Message-State: AOAM530mlEENmlnShCevx7cf2bUyFlWq21kcLd/OIegKCuDhff4lzDLm Vin/GuWv24K7IKjSMRuvaHRJwyjqyKs+AaL0zFT46PR7sp23Q1xNNYplv6eI+vFWdEJ3b6e/Jil nLJlu21aVYSdfB/CyO5QTRQB0 X-Received: by 2002:a05:6402:90c:: with SMTP id g12mr1207523edz.139.1633953564689; Mon, 11 Oct 2021 04:59:24 -0700 (PDT) X-Received: by 2002:a05:6402:90c:: with SMTP id g12mr1207493edz.139.1633953564478; Mon, 11 Oct 2021 04:59:24 -0700 (PDT) Received: from redhat.com ([2.55.159.57]) by smtp.gmail.com with ESMTPSA id lb12sm3498129ejc.28.2021.10.11.04.59.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 04:59:23 -0700 (PDT) Date: Mon, 11 Oct 2021 07:59:17 -0400 From: "Michael S. Tsirkin" To: Andi Kleen Cc: 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 , Paolo Bonzini , David Hildenbrand , Andrea Arcangeli , Josh Poimboeuf , Peter H Anvin , Dave Hansen , Tony Luck , Dan Williams , Kirill Shutemov , Sean Christopherson , Kuppuswamy Sathyanarayanan , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, linux-alpha@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, virtualization@lists.linux-foundation.org Subject: Re: [PATCH v5 12/16] PCI: Add pci_iomap_host_shared(), pci_iomap_host_shared_range() Message-ID: <20211011073614-mutt-send-email-mst@kernel.org> References: <20211009003711.1390019-1-sathyanarayanan.kuppuswamy@linux.intel.com> <20211009003711.1390019-13-sathyanarayanan.kuppuswamy@linux.intel.com> <20211009053103-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Oct 10, 2021 at 03:22:39PM -0700, Andi Kleen wrote: > > > To which Andi replied > > One problem with removing the ioremap opt-in is that > > it's still possible for drivers to get at devices without going through probe. > > > > To which Greg replied: > > https://lore.kernel.org/all/YVXBNJ431YIWwZdQ@kroah.com/ > > If there are in-kernel PCI drivers that do not do this, they need to be > > fixed today. > > > > Can you guys resolve the differences here? > > > I addressed this in my other mail, but we may need more discussion. Hopefully Greg will reply to that one. > > > > > And once they are resolved, mention this in the commit log so > > I don't get to re-read the series just to find out nothing > > changed in this respect? > > > > I frankly do not believe we are anywhere near being able to harden > > an arbitrary kernel config against attack. > > Why not? Device filter and the opt-ins together are a fairly strong > mechanism. Because it does not end with I/O operations, that's a trivial example. module unloading is famous for being racy: I just re-read that part of virtio drivers and sure enough we have bugs there, this is after they have presumably been audited, so a TDX guest is better off just disabling hot-unplug completely, and hotplug isn't far behind. Malicious filesystems can exploit many linux systems unless you take pains to limit what is mounted and how. Networking devices tend to get into the default namespaces and can do more or less whatever CAP_NET_ADMIN can. Etc. I am not saying this makes the effort worthless, I am saying userspace better know very well what it's doing, and kernel better be configured in a very specific way. > And it's not that they're a lot of code or super complicated either. > > You're essentially objecting to a single line change in your subsystem here. Well I commented on the API patch, not the virtio patch. If it's a way for a driver to say "I am hardened and audited" then I guess it should at least say so. It has nothing to do with host or sharing, that's an implementation detail, and it obscures the actual limitations of the approach, in that eventually in an ideal world all drivers would be secure and use this API. Yes, if that's the API that PCI gains then virtio will use it. > > How about creating a defconfig that makes sense for TDX then? > > TDX can be used in many different ways, I don't think a defconfig is > practical. > > In theory you could do some Kconfig dependency (at the pain point of having > separate kernel binariees), but why not just do it at run time then if you > maintain the list anyways. That's much easier and saner for everyone. In the > past we usually always ended up with runtime mechanism for similar things > anyways. > > Also it turns out that the filter mechanisms are needed for some arch > drivers which are not even configurable, so alone it's probably not enough, I guess they aren't really needed though right, or you won't try to filter them? So make them configurable? > > > Anyone deviating from that better know what they are doing, > > this API tweaking is just putting policy into the kernel ... > > Hardening drivers is kernel policy. It cannot be done anywhere else. > > > -Andi To clarify, the policy is which drivers to load into the kernel. -- MST