🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17162

Re: [PATCH 17/17] PCI: Replace untrusted state with device trust

#17162
From: Aneesh Kumar K.V
Date: Mon, 16 Nov 2026 13:08
108 lines
11990 bytes
Leon Romanovsky <leon@kernel.org> writes:

> From: Leon Romanovsky <leonro@nvidia.com>
>
> Convert the PCI specific untrusted to use the common device trust
> level. Adversarial means the same thing untrusted does.
>
> PCI discovery keeps the logic that set untrusted: it looks for removable
> PCI devices with arch_pci_dev_is_removable() and defaults them to an
> adversarial policy. Treat a disabled policy the same way when choosing
> the IOMMU domain. Do not record the ATS capability of such a device, as
> pci_ats_supported() rejected untrusted ones. Let the Intel write-buffer
> quirk apply, as it only adds flushing.
>

 [ ... 28 lines skipped ... ] 

> diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c
> index 78742aeba932d..a48fb511bfe6f 100644
> --- a/drivers/iommu/dma-iommu.c
> +++ b/drivers/iommu/dma-iommu.c
> @@ -589,16 +589,11 @@ static int iova_reserve_iommu_regions(struct device *dev,
>  	return ret;
>  }
>  
> -static bool dev_is_untrusted(struct device *dev)
> -{
> -	return dev_is_pci(dev) && to_pci_dev(dev)->untrusted;
> -}
> -

 [ ... 244 lines skipped ... ] 

> diff --git a/include/linux/device.h b/include/linux/device.h
> index 65ea07c9ac35b..870ce14924905 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -934,6 +934,11 @@ static inline bool device_iommu_mapped(struct device *dev)
>  	return (dev->iommu_group != NULL);
>  }
>  
> +static inline bool device_policy_is_adversarial(const struct device *dev)
> +{
> +	return READ_ONCE(dev->trust_policy) == DEVICE_TRUST_POLICY_ADVERSARY;
> +}
> +
>  /* Get the wakeup routines, which depend on struct device */
>  #include <linux/pm_wakeup.h>
>  
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index aa3765a20a96c..087c63b177c85 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -490,14 +490,6 @@ struct pci_dev {
>  	unsigned int	shpc_managed:1;		/* SHPC owned by shpchp */
>  	unsigned int	is_thunderbolt:1;	/* Thunderbolt controller */
>  	unsigned int	is_cxl:1;               /* Compute Express Link (CXL) */
> -	/*
> -	 * Devices marked being untrusted are the ones that can potentially
> -	 * execute DMA attacks and similar. They are typically connected
> -	 * through external ports such as Thunderbolt but not limited to
> -	 * that. When an IOMMU is enabled they should be getting full
> -	 * mappings to make sure they cannot access arbitrary memory.
> -	 */
> -	unsigned int	untrusted:1;
>  	/*
>  	 * Info from the platform, e.g., ACPI or device tree, may mark a
>  	 * device as "external-facing".  An external-facing device is
> @@ -616,6 +608,28 @@ static inline struct pci_dev *to_pci_dev(const struct device *dev)
>  {
>  	return container_of(dev, struct pci_dev, dev);
>  }
> +
> +static inline bool
> +pci_dev_default_is_restricted(const struct pci_dev *pdev)
> +{
> +	enum device_trust_policy policy = READ_ONCE(pdev->dev.trust_policy);
> +
> +	return policy == DEVICE_TRUST_POLICY_DISABLED ||
> +	       policy == DEVICE_TRUST_POLICY_ADVERSARY;
> +}
> +

Could you clarify how this series will work alongside device acceptance
and private-memory access?

In particular, what should callers of device_cc_accepted() use under
this model? My understanding is that trust describes the operating
policy, not TDISP acceptance or DMA access to private memory. Therefore,
neither FULL nor ADVERSARY alone indicates whether a device can access
private memory?

You also mention that once a trust level other than DISABLED is set, it
cannot be changed during the device's lifetime. If a device initially
operates in ADVERSARY mode and later attestation justifies FULL
operation, is that transition intentionally unsupported for the existing
device object? As documented, unbind/rebind and reset preserve the
committed level.

Some of these details are discussed in this thread:
https://lore.kernel.org/all/20260708143153.GH118978@ziepe.ca/

It would help to describe how the trust framework fits together with
those separate mechanisms, including which pieces are left for follow-up
series.

-aneesh
Technical Details
Message-ID: <yq5amrr8yldi.fsf@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364325-linux-kernel-netdev=dewy.ru
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com> <20261105-device-trust-core-v1-17-1e536825b4eb@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364325-linux-kernel-netdev=dewy.ru
From: aneesh.kumar@kernel.org (Aneesh Kumar K.V)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH 17/17] PCI: Replace untrusted state with device trust
Date: Mon, 16 Nov 2026 18:38:25 +0530
Organization: Usenet Network
Message-ID: <yq5amrr8yldi.fsf@kernel.org>
References: <20261105-device-trust-core-v1-0-1e536825b4eb@nvidia.com>
 <20261105-device-trust-core-v1-17-1e536825b4eb@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: usenet.network;
	logging-data="2068884"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:QZLKmfPHrPFARPkJ7dMotRWcADg= sha256:7ia7qxqlE39JrPkr9ZSm68vaxGE/bdtqX5ZMzboiw+Q=
	sha1:LFJohnR7a2amXFiSKIZB+5QKDKk= sha256:smOPSNnEMcqeFGddeL2oqJirRLcjh9Rv+q4YH9JBYm8=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id F00B4114C17; Mon, 16 Nov 2026 16:09:16 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id 3gijcekrSjJd;
	Mon, 16 Nov 2026 16:09:11 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364325-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id DB163114B9F; Mon, 16 Nov 2026 16:09:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B56072F561; Mon, 16 Nov 2026 13:08:48 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1794834523;
	b=p1o38OMullVZkbLNThVEQovn5sODM17WVDsewPzAFpJxwluZ6v8bjHg4uUwBAczZH0zT
	 C1Sg6msQjk9e6NTfcdOubE4yt6pOYFXNfn5mPqHqxTWIBhbiFtRFkBNrg885vtfFxoA7J
	 Ec8Zr+doCSlsGH5AnC/bBaEdlXsgqf21aD61CMoy3y9CAfDDkuf87Q6lGUuIKIbvulTuL
	 8S5pfduQXWgesO6p/4iWMULDTjfheiCbcCXR363dxsUL1pBLLGEkZShXJ+82tvbzd5GHO
	 It4gFFamAS9dr14mKEUlIDbaVw3EQH5Gtxy56EUYd5BC8Q503Z7UBjA5QzC+OD82R2Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794834523;
	h=X-Original-To:Received:Received:DKIM-Signature:X-Mailer:From:To:Cc:
	 Subject:In-Reply-To:References:Date:Message-ID:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Type;
	bh=FwoCPPpdO8j0QQzLogIM9E8IgkHPKoUE54w1Plha5dw=;
	b=vf4IaE7fxdUHDsfvVmHC4nzk3ZIg8IXlR063SB4kLWHnxBVr/dMOub1n+pFt+Ov6Rrqd
	 NRNxCRqMcTk99KW9qrPAq99vEibhEC0nQjdh1BTdy0n3z30ib94C2KaGlp4mmls+SoPhw
	 fQ5vTc0ChzjyyFAPivHU6jaU+HG3gvtpC+SdKEzJXpFKUBAdAZkipz6YofszmhVsQEyaL
	 djWGFEfZ0gOH+4OB9N884isL3uJ512LI8uPCIfYyLIjMmY+SsQILJiGSujEl1fcBu3f5S
	 9YL/i/AxPtufoSe6r0ZNs/llZSZg/fj4qKA240Jtmnp5YBwPhkFQNVDT5cKNJrx9wcg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LIc5lPy1;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 95884606A881;
	Mon, 16 Nov 2026 13:08:43 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LIc5lPy1
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794834522;
	b=qYHWbcj4z8WImWhy53t+R3uRL9JesMam8zp4slv6kPuSDFtS4xtHNwUR0JeJO22D2eLa
	 O6qPgJhGfpTk9D+BkNNAdv1fGlizhHDiQiQzG0tKsQlP87hfPFMzAsn6C+VI+0FpCnAJB
	 BHOQwawzgNX4lqyfHdwaOTLoagWAnlm3qzjM8xV2FHLE+SxW8W9Z1N0AgJjMad3MHDelG
	 j85Ti+rNvG0MyfHZLT7vLTjKu1J7eXwTVB928Wab4aXlssViIQ0bUgP/es2Oy7E3NVkCp
	 xVaotvife7iQJquxfVsGN1I84Ws64Mr994TNZwNcpHL0k//Ev7Hhf0fhhwu6ZmMbN5w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794834522;
	h=Received:DKIM-Signature:X-Mailer:From:To:Cc:Subject:In-Reply-To:
	 References:Date:Message-ID:MIME-Version:Content-Type;
	bh=FwoCPPpdO8j0QQzLogIM9E8IgkHPKoUE54w1Plha5dw=;
	b=g5T2LIQhBkTcsMozvcwrUyP+MygohRJqOAd5/pHxuV6GYHgVaX9agEodLoUFvRvJD145
	 32F+rkLvBLHeJAtKAejr/AycEFr63qb9YQKot8lcsnXAyRJeKyHcpOE2XooxbblIiYkDb
	 y8KgUrus4Y2xq+bYmtcB4hx/8+4dGSUZehDBmwgNCyRezRg0E3f5CHFwVoggdpLnxKG7Y
	 ujQmZzq29Q6MsLnIz/CZMUiaPvY1Z4JJInTPaK00F080DNEcVacjQXG4dRKDd8k7lJFmq
	 zHynIvoMJJwx1BHPvZXPcu+A2fzfd4vs1tMNrI3MF+6wELsvxIcxUnguDXvcIDUJF7w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=LIc5lPy1;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0D07606A33B;
	Mon, 16 Nov 2026 13:08:42 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 612A41F000C5;
	Mon, 16 Nov 2026 13:08:29 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794834522;
	bh=FwoCPPpdO8j0QQzLogIM9E8IgkHPKoUE54w1Plha5dw=;
	h=From:To:Cc:Subject:In-Reply-To:References:Date;
	b=LIc5lPy1D71RQN2xAbDw2oXaH5IV6pJ32H0KUZEqe8L249TmRi2WTJNQxKcuU1wEO
	 oLm11Z/jqifv9rpcqf6oDFERa929d+JDfwRjC64Lnedd+EABh/BlgjMO2vcuLflph1
	 8ElRVqEMjm7Be2V+wkEQvCuB9EDMcj/MMyH7AM8kqurVjgwf5jK5SAvnQJxVfCyPce
	 WrnayG/saturD08cn49YyfcaDZzfKPuzx0jRt56/DImYkW4CmT1Kyp50jL+nYJU21v
	 MsNp1ZjKlC00n397AZiiTcJm11MwJ1MeO9np8vdTOwAxjjQ4K/7vmluasP5XB0SeNC
	 zhGRJWHaUOOpw==
X-Mailer: emacs 31.1 (via feedmail 11-beta-1 I)
X-Cc: linux-kernel@vger.kernel.org, driver-core@lists.linux.dev,
	linux-input@vger.kernel.org, netdev@vger.kernel.org,
	linux-wireless@vger.kernel.org, linux-usb@vger.kernel.org,
	linux-bluetooth@vger.kernel.org, linux-acpi@vger.kernel.org,
	linux-doc@vger.kernel.org, linux-pci@vger.kernel.org,
	iommu@lists.linux.dev, Jason Gunthorpe <jgg@ziepe.ca>
X-In-Reply-To: <20261105-device-trust-core-v1-17-1e536825b4eb@nvidia.com>
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list