Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp2623317pxb; Sun, 17 Oct 2021 20:48:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxFBErLICcfogKrwoiQNUKN9+B4uY/4WOsMD5uF4ysroZ4IiMarNKbd2RKcIEDizLL5MNo5 X-Received: by 2002:a17:90a:df02:: with SMTP id gp2mr11109197pjb.196.1634528906036; Sun, 17 Oct 2021 20:48:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634528906; cv=none; d=google.com; s=arc-20160816; b=EetmQAxMvabgxJX486TqAXQLCBuiGaF7yuhmu4uuqDHi22hr5a1SY+LTBMj2WIXU97 /Cc3nUfNPqBwytiuNBWolsu1iJ3SN59d0Vw/nmIioF4LRZtAbOr8sv+eqAm7iu8eTo0U +lwcOGNtokpTWwULw4krYVQvOQP1GdmZvM9BEaPM4UKdWatzy0kqEPmET24ljuFsMK+c HYk+CWFlRB+j7RA/E+Ql0u1EgqWM5pMdf4NuMnrotnT1EvpD340bRPR4rr355ZVxx3O3 SN2GR6Aqrxy3g/rTAUZKaG7R4gEPHv2ICinINJrtzHHVcBknNNtuHpazHD2rYKzktkpd PYfQ== 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=VC0sWKuJ5MpDbY6DXl9zvz5o696+GJBNvO+SxKY2kO8=; b=gS8Snijf4Y5U4JV6FZUeOPS3ElFqW7W2m43DMvgPtKKnlN32Ynl/bKVuSWYKYjbBkz +gJTs1BHl7AWiHlXt3OLa6yORlq2gbI7ulEHt1FVFrlyXBAIbNP+R7I1b80MNbaNYu/I 5TMP5rM0MOpobP0gZEDbWfcaottz9nIkE0qSKNXnFyqhOjwvKmVaiTFcBQEGCXF4rTY6 74OMTlEx9TcjHaHFzLdCL2Bpr9+eRU0Ty7jOTJmJbtYzgECdPv4ilOou6JMYLMbAra/n /BFlf9EARx5Td3sve/6T4HNPY7roMJOuG4wGDRlc4kfCNb51VvEFVedHf5ZIGW03HeiM NhBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G8AeDIZn; 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 v29si16921295pgk.515.2021.10.17.20.48.14; Sun, 17 Oct 2021 20:48: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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=G8AeDIZn; 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 S1344784AbhJQWT2 (ORCPT + 98 others); Sun, 17 Oct 2021 18:19:28 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:37431 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344803AbhJQWT1 (ORCPT ); Sun, 17 Oct 2021 18:19:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1634509036; 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=VC0sWKuJ5MpDbY6DXl9zvz5o696+GJBNvO+SxKY2kO8=; b=G8AeDIZnevTk+99Y+WSEeg/b0eYg1+NVYjZCXSFYjObwSxI1NUpIIZuSExwGgH7Yjyo8w+ /z7jgwteZmXKuuTbLaTnt1/7MbTRaeqj6FY9/bSMzkZpLpaN152/wl7pKyOyksDCU/N9/4 nWAwiv3kPfDMtHWNnkU+3Y+LPv37N4g= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-510-QdJ2C5jlOyiB7gdhQPqccA-1; Sun, 17 Oct 2021 18:17:15 -0400 X-MC-Unique: QdJ2C5jlOyiB7gdhQPqccA-1 Received: by mail-ed1-f70.google.com with SMTP id x5-20020a50f185000000b003db0f796903so12529272edl.18 for ; Sun, 17 Oct 2021 15:17:15 -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=VC0sWKuJ5MpDbY6DXl9zvz5o696+GJBNvO+SxKY2kO8=; b=cCtUt3eV+O7rns1cjV+Af6olrTv4xppEnLAfRX8ipeKoJStPNaJ531J+5fcuR2S3If CHCFGE5EApdDUz7hsAwwiRY50Y0or2k8Kp5z68e8f8hUMXjGwHkGoPAxj7xyFdXJEbVx O4pn44wBC6d304KPGD7OlEgwgFETjb+QijlFXXdsQqk6KJK2oWsWmPPeJ09SZV2zIaRZ H1EipVpGyKYI9egI3yySUC7DxYmCHPjnp5PDYSzq6Nm/vDeKxPJgnwHOp84NVF6SBx5I 697I5tMHskOrmaaScK7Q7pvK3Ld/woxq8sqAaKo8MUnhufpkHiG25JVP5M8LaeKLXk1P joBg== X-Gm-Message-State: AOAM531Fh3+u96IG3oDDu7HR8PNo3t/vx/zWAx7GesNz7Xy9f+Pqv1qB j+aQK+1dDlurt+18T+ICrGlzJKgnrWUIQ4aMUw6Lbw9qJOPV+Gc3ofLT/olx9/DNLnbtG/MRQgy Fm1nJLGaPxux3QkazCP3iHEnp X-Received: by 2002:a17:906:38db:: with SMTP id r27mr24705890ejd.338.1634509034123; Sun, 17 Oct 2021 15:17:14 -0700 (PDT) X-Received: by 2002:a17:906:38db:: with SMTP id r27mr24705846ejd.338.1634509033862; Sun, 17 Oct 2021 15:17:13 -0700 (PDT) Received: from redhat.com ([2.55.147.75]) by smtp.gmail.com with ESMTPSA id kw5sm7937099ejc.110.2021.10.17.15.17.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Oct 2021 15:17:12 -0700 (PDT) Date: Sun, 17 Oct 2021 18:17:04 -0400 From: "Michael S. Tsirkin" To: "Reshetova, Elena" Cc: Andi Kleen , "Williams, Dan J" , Kuppuswamy Sathyanarayanan , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , "Lutomirski, Andy" , 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 , "Hansen, Dave" , "Luck, Tony" , 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" Subject: Re: [PATCH v5 12/16] PCI: Add pci_iomap_host_shared(), pci_iomap_host_shared_range() Message-ID: <20211017180950-mutt-send-email-mst@kernel.org> References: <20211009053103-mutt-send-email-mst@kernel.org> <0e6664ac-cbb2-96ff-0106-9301735c0836@linux.intel.com> <20211012171016-mutt-send-email-mst@kernel.org> <20211014025514-mutt-send-email-mst@kernel.org> <20211014052605-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 Thu, Oct 14, 2021 at 12:33:49PM +0000, Reshetova, Elena wrote: > > On Thu, Oct 14, 2021 at 07:27:42AM +0000, Reshetova, Elena wrote: > > > > On Thu, Oct 14, 2021 at 06:32:32AM +0000, Reshetova, Elena wrote: > > > > > > On Tue, Oct 12, 2021 at 06:36:16PM +0000, Reshetova, Elena wrote: > > > > > > > > The 5.15 tree has something like ~2.4k IO accesses (including MMIO and > > > > > > > > others) in init functions that also register drivers (thanks Elena for > > > > > > > > the number) > > > > > > > > > > > > > > To provide more numbers on this. What I can see so far from a smatch- > > based > > > > > > > analysis, we have 409 __init style functions (.probe & builtin/module_ > > > > > > > _platform_driver_probe excluded) for 5.15 with allyesconfig. > > > > > > > > > > > > I don't think we care about allyesconfig at all though. > > > > > > Just don't do that. > > > > > > How about allmodconfig? This is closer to what distros actually do. > > > > > > > > > > It does not make any difference really for the content of the /drivers/*: > > > > > gives 408 __init style functions doing IO (.probe & builtin/module_ > > > > > > > _platform_driver_probe excluded) for 5.15 with allmodconfig: > > > > > > > > > > ['doc200x_ident_chip', > > > > > 'doc_probe', 'doc2001_init', 'mtd_speedtest_init', > > > > > 'mtd_nandbiterrs_init', 'mtd_oobtest_init', 'mtd_pagetest_init', > > > > > 'tort_init', 'mtd_subpagetest_init', 'fixup_pmc551', > > > > > 'doc_set_driver_info', 'init_amd76xrom', 'init_l440gx', > > > > > 'init_sc520cdp', 'init_ichxrom', 'init_ck804xrom', 'init_esb2rom', > > > > > 'probe_acpi_namespace_devices', 'amd_iommu_init_pci', 'state_next', > > > > > 'arm_v7s_do_selftests', 'arm_lpae_run_tests', 'init_iommu_one', > > > > > > > > Um. ARM? Which architecture is this build for? > > > > > > The list of smatch IO findings is built for x86, but the smatch cross function > > > database covers all archs, so when queried for all potential function callers, > > > it would show non x86 arch call chains also. > > > > > > Here is the original x86 finding and call chain for the 'arm_v7s_do_selftests': > > > > > > Detected low-level IO from arm_v7s_do_selftests in fun > > > __iommu_queue_command_sync > > > > > > drivers/iommu/amd/iommu.c:1025 __iommu_queue_command_sync() error: > > > {15002074744551330002} > > > 'check_host_input' read from the host using function 'readl' to a > > > member of the structure 'iommu->cmd_buf_head'; > > > > > > __iommu_queue_command_sync() > > > iommu_completion_wait() > > > amd_iommu_domain_flush_complete() > > > iommu_v1_map_page() > > > arm_v7s_do_selftests() > > > > > > So, the results can be further filtered if you want a specified arch. > > > > So what is it just for x86? Could you tell? > > I can probably figure out how to do additional filtering here, but does > it really matter for the case that is being discussed here? Andi's point was > that there quite many existing places in the kernel when low-level IO > happens before the probe stage. So I brought these numbers here. > What do you plan to do with the pure x86 results? If the list is short - just suggest securing that ;) > And here are the full results for allyesconfig, if anyone is interested (just got permission to create > the repository today): > https://github.com/intel/ccc-linux-guest-hardening/tree/master/audit/sample_output/5.15-rc1 > We will be pushing to this repo all the scripts and fuzzing setups we use as part of > our Linux guest hardening effort for confidential cloud computing, but it is going to take > some time to get all the approvals collected. > > Best Regards, > Elena.