Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp1814936rwa; Sun, 21 Aug 2022 18:17:58 -0700 (PDT) X-Google-Smtp-Source: AA6agR5baYiLJom4Girr4v6jTwki4kSQiMopmSBKO+aFI2ndvFf6gK36tFPpAu13GTaCW+q16rXD X-Received: by 2002:a05:6402:26cb:b0:43e:6fab:11c6 with SMTP id x11-20020a05640226cb00b0043e6fab11c6mr13787268edd.272.1661131078176; Sun, 21 Aug 2022 18:17:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661131078; cv=none; d=google.com; s=arc-20160816; b=KCscrz4vkhzPpXzdyMK/I8W5p2zJ1MoSbUpmaB8oIiSd+u013VY+OCVDSmwiZmnTBl DZbSAk30ZOb46glVr4BsPuy1qlkoEAqUbn/8HYNOM7NeFqZ6XGVvJ04ZE36slhDw9Vyb SSH2yu4f+b9rRPk87dPem2yBU8VCb+yhgrVH+JqwTmMMLMi7TkPFMFnPxRZdchHexZxQ tjLNV0g7EftmUTX594vzW6/Vf7Boolxf2zYkKLLz4RdZ4LZbMiGDTu/cj9CXsWNZSLgv +YXbOR0tpl6sXp2XgTVKu9EdXHvTK+ACxNTWSIc0jww0Fjff35JsSTJMeUEC5+tgJupp Knrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=KS7D759omj+SlCHCy4DHnF34TIXyav2HHahUCKMfHS4=; b=gLtElcnrypvOvFdefIeW8TfAA7D7Mz9lvgI34CYh+XpCDuOszdSRHfVbTi9b28/5wN 7pM/GtI85F59zkC5eVvo+slr894AhC4ejWhgUgLQe5Tiq8ta56sqMWivkTctdBB8ENsp QcRunbYqlksBs909KV1FU7Rzpq5nOpFLrmDchuUtD5HII4lC83SadbTk/vPnS2IDW/b+ Rc+ZV+3yhvwgR8aif0b9xoxnb3mzh/85xVLOirrqUgtEd2DF6omw5xJ25McgnCHktOsR LutvCNDjaR7ZiewZMqAJJQWaiprNXzGKeTqyp1XmxQEJ97J255dOFY/lFQfx0HZr1EBT kU7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fuP2Argl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k2-20020a17090666c200b007317ad1f9a4si7022206ejp.310.2022.08.21.18.17.32; Sun, 21 Aug 2022 18:17:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=fuP2Argl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232158AbiHVAxJ (ORCPT + 99 others); Sun, 21 Aug 2022 20:53:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55630 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232156AbiHVAxF (ORCPT ); Sun, 21 Aug 2022 20:53:05 -0400 Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04E65205E8; Sun, 21 Aug 2022 17:53:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661129582; x=1692665582; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=vAVd2DD6t9I+Xtmsril7vUCCDTiDliFF7Nj/PCNMHkc=; b=fuP2Arglkj/rrQtGKf67SibUIet0qRKeKRn1TD4oBkD8ukzGnZjVHxtP 1LWFzd0CCmQApoh2H/SmvW4/q2yYAHS9SFPEKROTbaDiamkzO69jNlN+4 Qeu3ysQM1XhJ1BR8D5dCifbS+PPr+8UcZ8pZL7nssRxDC7+lOz823x8iB R7/whcXs22UTrTEcPobKWyCXwIj9lza32H491S3dVBI89i/H+ihalysgC AE0/CUmRPmh2J8O3dyFbCMNVFGMitTrULcvHkco//yZH8Anu2uc13xlyh 23B/EgkMVfNHEhrnAHWEOV0XC98I5U4zqdDYIxik00GTjYhy44PY+5laO A==; X-IronPort-AV: E=McAfee;i="6500,9779,10446"; a="294574753" X-IronPort-AV: E=Sophos;i="5.93,254,1654585200"; d="scan'208";a="294574753" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2022 17:53:01 -0700 X-IronPort-AV: E=Sophos;i="5.93,254,1654585200"; d="scan'208";a="669297118" Received: from iweiny-mobl.amr.corp.intel.com (HELO localhost) ([10.213.163.128]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Aug 2022 17:52:39 -0700 From: ira.weiny@intel.com To: Dan Williams , Bjorn Helgaas , Greg Kroah-Hartman Cc: Ira Weiny , Jonathan Cameron , Alison Schofield , Vishal Verma , Ben Widawsky , linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Subject: [PATCH 0/2] CXL: Taint user access to DOE mailbox config space Date: Sun, 21 Aug 2022 20:52:35 -0400 Message-Id: <20220822005237.540039-1-ira.weiny@intel.com> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ira Weiny PCI config space access from user space has traditionally been unrestricted with writes being an understood risk for device operation. Unfortunately, device breakage or odd behavior from config writes lacks indicators that can leave driver writers confused when evaluating failures. This is especially true with the new PCIe Data Object Exchange (DOE) mailbox protocol where backdoor shenanigans from user space through things such as vendor defined protocols may affect device operation without complete breakage. Even though access should not be restricted it would be nice for driver writers to be able to flag critical parts of the config space such that interference from user space can be detected. Introduce pci_request_config_region_exclusive() and use it in the CXL driver for DOE config space. Ira Weiny (2): PCI: Allow drivers to request exclusive config regions cxl/doe: Request exclusive DOE access drivers/cxl/pci.c | 5 +++++ drivers/pci/pci-sysfs.c | 6 ++++++ drivers/pci/probe.c | 6 ++++++ include/linux/ioport.h | 2 ++ include/linux/pci.h | 16 ++++++++++++++++ include/uapi/linux/pci_regs.h | 1 + kernel/resource.c | 13 ++++++++----- 7 files changed, 44 insertions(+), 5 deletions(-) base-commit: 1cd8a2537eb07751d405ab7e2223f20338a90506 -- 2.37.2