🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16996

Re: [PATCH V1 rdma-next 09/24] RDMA/core: Suppress kverbs_provider for adversarial_mode devices

#16996
From: Leon Romanovsky
Date: Mon, 16 Nov 2026 08:58
63 lines
10037 bytes
On Tue, Nov 10, 2026 at 03:43:05PM +0200, Yishai Hadas wrote:
> In adversarial mode the NIC is not trusted. Kernel ULPs such as MAD,
> IB CM, rdma_cm, IPoIB, SRP, iSER and NVMe-oF trust what the device
> reports, its completions and the data it writes, so they must not use
> such a device.
> 
> Add an adversarial_mode field to struct ib_device and clear
> kverbs_provider when it is set. add_client_context() then skips every
> client but uverbs, the only one that sets no_kverbs_req, so the kernel
> ULPs never bind to the device.
> 
> The driver still implements the kverbs ops, as the uverbs path shares
> them, so kverbs_provider can't be cleared by the existing check of the
> mandatory ops.
> 
> Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
> ---
>  drivers/infiniband/core/device.c | 8 ++++++++
>  include/rdma/ib_verbs.h          | 2 ++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/drivers/infiniband/core/device.c b/drivers/infiniband/core/device.c
> index 29af9fe860e2..eb6aa567d365 100644
> --- a/drivers/infiniband/core/device.c
> +++ b/drivers/infiniband/core/device.c
> @@ -312,6 +312,14 @@ static void ib_device_check_mandatory(struct ib_device *device)
>  			break;
>  		}
>  	}
> +
> +	/*
> +	 * Kernel ULPs must not bind to an adversarial_mode device. Its kverbs
> +	 * ops are still present, as uverbs uses them, so clear kverbs_provider
> +	 * explicitly. uverbs sets no_kverbs_req, so it still binds.
> +	 */
> +	if (device->adversarial_mode)

In previous patch, you talked that adversarial is global for all
devices, but here you add per-device flag.

Thanks

> +		device->kverbs_provider = false;
>  }
>  
>  /*
> diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
> index d6eaa3fee66e..6209a5166f0d 100644
> --- a/include/rdma/ib_verbs.h
> +++ b/include/rdma/ib_verbs.h
> @@ -3008,6 +3008,8 @@ struct ib_device {
>  	u16                          use_cq_dim:1;
>  	/* CoCo guest with DMA bounce buffering required */
>  	u16                          cc_dma_bounce:1;
> +	/* Untrusted-NIC, adversarial mode is required */
> +	u8			     adversarial_mode;
>  	u8                           node_type;
>  	u32			     phys_port_cnt;
>  	struct ib_device_attr        attrs;
> -- 
> 2.18.1
> 
Technical Details
Message-ID: <20261116085817.GB11319@unreal>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364115-linux-kernel-netdev=dewy.ru
References: <20261110134320.34408-1-yishaih@nvidia.com> <20261110134320.34408-10-yishaih@nvidia.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-364115-linux-kernel-netdev=dewy.ru
From: leon@kernel.org (Leon Romanovsky)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH V1 rdma-next 09/24] RDMA/core: Suppress kverbs_provider
 for adversarial_mode devices
Date: Mon, 16 Nov 2026 10:58:17 +0200
Organization: Usenet Network
Message-ID: <20261116085817.GB11319@unreal>
References: <20261110134320.34408-1-yishaih@nvidia.com>
 <20261110134320.34408-10-yishaih@nvidia.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: usenet.network;
	logging-data="2014834"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:+wfGesBGNSWwbFMTfXL9nNNsUWo= sha256:qSJ2OmlVbTE+qu4ObmrwsM/L2T47buI/H0zGT+MeAns=
	sha1:yGWgbE9zFuKOyJEy3MUDRrBnig0= sha256:GmJ8FUPRLLbvOFvIHgiM3TOxkzKABSxZlwWuGorQNhI=
Content-Disposition: inline
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 5A6AA114B63; Mon, 16 Nov 2026 11:58:35 +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 Y_IiQMSUXvLv;
	Mon, 16 Nov 2026 11:58:32 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-364115-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 16765114B3D; Mon, 16 Nov 2026 11:58:24 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7C8AD2CB90; Mon, 16 Nov 2026 08:58:22 +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=1794819501;
	b=rWAvBCKp6XMrJxMlNaaeSEZnLqZdiKBjeMgfyG+Vahlr4ClLtUZSlHsG4wtFzapE0nou
	 HFM2abLRrISKpMTXdpahiOrd6lIU0eOsMs4ftQ+/JXnEHyRQtfgmFyE2vlq4UqOPs9iPr
	 GK2g9VW7T31PJx97BTVMJIHvrVmCd7xXvGglIxSCQGJ9bqVX+2W78BQ73UTybRmmTUuof
	 vXDcypBonfwg04R6H6ihBi4yfOXdWEGz97nC6CCCydBb57bD5gcr3nlISxWT25aOOEGUB
	 HP8Fmg7ICHEnyoNtUXEylOxzNx1GctGeKccFZmErtUttTq3SlvVUR8OLZLM0ntPXuMA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794819501;
	h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc:
	 Subject:Message-ID:References:X-Mailing-List:List-Id:List-Post:
	 List-Help:List-Subscribe:List-Unsubscribe:List-Owner:Precedence:
	 MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=jTw0z7j7ixfVgy+ekqc6oztblUCg4IwIkezDOKgUmN4=;
	b=irkk1jJOE9PA1D4GVDL+SSqYrLsNKXbXCsSx8Fg2bPyx2/G8ncPAtsslocNuOcwbZpHO
	 ROHxXgTqdXbNK5hT/EL3g1PSLfrT7hgIV5Fdx1P8Ozq3un7pTm4h3Pswv9/pRVHAKwVhk
	 /Ay5R10b6MLqkqK8WTXMPlEmMNcQfu7WNVNX0BRn20rYvP3+6Z5who5ztm2mikWfYqneR
	 vCj6NRNZiiubkXOAPCNx8/W9IWVjjuQn8eFpmLjEg4V4sBbpNyhO/kn/xXQRlUHJKvQCu
	 CpIXGgjcEmcaUc2E+mC0BkuBnaSwEVNNxp9yHNq3hI4Pri9ChEp6aYKt3Ae2CHcXQyA==
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=CgVlUaF1;
	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 C2052606A335;
	Mon, 16 Nov 2026 08:58:21 +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=CgVlUaF1
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=1794819501;
	b=FIeK+UJPl/jlESR8QvugYoctN+jqlU86b++DQxrWXZuQwbZGuQX/4OTLhFXReX9mpboz
	 ZLuml/BtGCzuSze33TMHA1hmzIewuUhgqifE4JRUeGRA3LL/JrbL/TOuX4Rgp63RjYVaQ
	 hFp8o/6EpOQx9gnkxOXbvarvusrxJ6PsWvT9ur5SMxXU9Kmo/vdTMxCXvpWDaSV7oTN3/
	 xVY0uqvvan/O/19hB4JE36zWav35yiNDv8ycBYWFdE/L+bH+cd8bIXfzxpbVlmP4zQunu
	 wyUNipEvxkfxEUARiywFKEMwv/6iSB3dPGX4/7s3leTVK0w5zRTDXFwLbviGqB1iVGg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794819501;
	h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID:
	 References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To;
	bh=jTw0z7j7ixfVgy+ekqc6oztblUCg4IwIkezDOKgUmN4=;
	b=KwHrtaWYbdc0i5zGknGJ+UC2hiMdlie6w5zXvoRKsYPw9KB38CqWZYLlZo6gYlovie+w
	 hp5tjwJCZ5diAWym1+ojNmIwfokeRgfghuyQjYJW3Fo8HlXPNprO124c82B9VchL638+C
	 gOLWq3l4zqf8bT2i0+m5xmQbBxmk4T1K2x8yFmtAUzVbZ9rWGWZ+Sad7Vc5Rw88yelaiS
	 S0MMwIHv/pDnSkmIfgWXZqxLbTVAtntWhpRuYTAIPRHr6swgKf9LA0EP8Rd5o+trV+3fv
	 OJqINnFqgjuTpWBx4PBidawitWaVOhwu8BWQ2YuDVBtiwZefwzFFiiJ8u8dA1NDr0lw==
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=CgVlUaF1;
	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 DFA48606A323;
	Mon, 16 Nov 2026 08:58:20 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id D96981F000C4;
	Mon, 16 Nov 2026 08:58:19 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794819500;
	bh=jTw0z7j7ixfVgy+ekqc6oztblUCg4IwIkezDOKgUmN4=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To;
	b=CgVlUaF1I9JnRZg+RLy+Vozz7/TOpmafLYsbHg0XbUEBhqHcJhfQ9nPO7DYkfiMRv
	 W9loe2mlpjbfkvsHlgxDHsDVexDgI4z2JTDUu3z7Sbyl59D8Rr6ft2CN8kpbJgrgcl
	 rxZ4IwX/uCsZjd4pDPv0fQtAfv61rRIIncj2HcPPQ7juuTFMMlxsWwaO0PhUrxLtaV
	 63RjdPgQW0v3npHqOFgAL0two/L7PwHqtB/dpiIcSWxPwjEoXt51HHCvszG6oOTN8h
	 5oify4pElaLQxDH/cXuV+4TVsCInFggJP9Ze5zShnFtStO5TvLAP1Kn5oAxWg4kmXE
	 7Ytj+W/DmJYDQ==
X-Cc: jgg@ziepe.ca, linux-rdma@vger.kernel.org, netdev@vger.kernel.org,
	saeedm@nvidia.com, tariqt@nvidia.com, mbloch@nvidia.com,
	kuba@kernel.org, pabeni@redhat.com, edumazet@kernel.org,
	davem@davemloft.net, andrew+netdev@lunn.ch, dtatulea@nvidia.com,
	moshe@nvidia.com, maorg@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
X-In-Reply-To: <20261110134320.34408-10-yishaih@nvidia.com>