🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #25573

[PATCH net v6 0/2] net/rds: fix the probe cm_id lock ordering

#25573
From: Aibing Chen
Date: Wed, 02 Dec 2026 02:40
78 lines
11784 bytes
syzbot reported a circular locking dependency between rds_trans_sem and
rdma_cm's handler_mutex:

  CPU0 (passive connection)          CPU1 (bind)
  ----                               ----
  mutex_lock(&handler_mutex)         down_read(&rds_trans_sem)
  rds_ib_cm_handle_connect()         rds_ib_laddr_check()
    rds_conn_create()                  rdma_destroy_id()
      rds_trans_get_preferred()          mutex_lock(&handler_mutex)
        down_read(&rds_trans_sem)

Patch 1 fixes the cycle the way the review asked for: take the module
reference for the candidate transport under rds_trans_sem, drop the
semaphore, and only then call ->laddr_check().

Running that on a two-node rxe setup showed one more problem on the same
path, which patch 2 fixes: when ->laddr_check() runs from the passive
connection path, cma_ib_req_handler() already holds the listener's
handler_mutex, and rds_ib_laddr_check() creates and destroys a probe
cm_id whose rdma_destroy_id() takes the handler mutex of the probe id.
Both are instances of the same lock class, so lockdep reports a
recursive locking dependency.  Destroy the probe id from rds_wq, where
neither lock is held.

Evidence, both nodes on a PROVE_LOCKING kernel, rxe0 on each node, an RDS
connection established and then a bind() to an address that is not on an
RDMA device (which is what reaches rds_ib_laddr_check_cm()):

  mainline:  WARNING: possible circular locking dependency detected
             rds_trans_sem --> &id_priv->handler_mutex
                           --> &id_priv->handler_mutex/1
             ... rdma_destroy_id <- rds_ib_laddr_check
                 <- rds_trans_get_preferred <- rds_bind
                 and down_read(rds_trans_sem) <- rds_trans_get_preferred
                 <- __rds_conn_create

  this series: no lockdep report at all in the same run.

I could not run syzbot's reproducer; the setup above is a hand-made
equivalent.  No runtime testing on real RDMA hardware was done, so the
patches are compile tested (W=1) and tested on rxe only.

v6:
- add patch 2: the ordering fix alone still leaves the probe cm_id
  destroy nested under the CM handler's mutex, which lockdep reports as
  recursive locking once the semaphore cycle is gone.
- patch 2 fails the address check with -ENOMEM above the bound instead
  of returning -EAGAIN, so rds_trans_get_preferred() cannot fall back to
  another transport.

v5:
- implement the ordering fix in rds_trans_get_preferred() as requested
  in the review (dropping the net/rds/ib.c workqueue, the global cap and
  the rds_wq flush of v4) and describe the report as a lock class
  conflict rather than a deadlock.

v4 and earlier:
- deferred rdma_destroy_id() to a workqueue and bounded the backlog.

Reported-by: syzbot+ccdb5058c3df2d94811c@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=ccdb5058c3df2d94811c
Suggested-by: Allison Henderson <achender@kernel.org>
Link: https://lore.kernel.org/all/d83709308a038467b3a4849d814978b84328d2bc.camel@kernel.org/
Fixes: ec16227e1414 ("RDS/IB: Infiniband transport")
Cc: stable@vger.kernel.org
Signed-off-by: Aibing Chen <chenaibing@cmss.chinamobile.com>

Aibing Chen (2):
  net/rds: drop rds_trans_sem around laddr_check()
  net/rds: defer the probe cm_id destroy to rds_wq

 net/rds/ib.c        | 50 +++++++++++++++++++++++++++++++++++++++++++++++--
 net/rds/transport.c | 24 +++++++++++++++-------
 2 files changed, 67 insertions(+), 7 deletions(-)

-- 
2.50.1.windows.1
Technical Details
Message-ID: <20261202024054.1945-1-chenaibing@cmss.chinamobile.com>
Path: mbox-mo1.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-375501-linux-kernel-netdev=dewy.ru

Show Full Headers
Complete Article Headers
Path: mbox-mo1.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-375501-linux-kernel-netdev=dewy.ru
From: chenaibing@cmss.chinamobile.com (Aibing Chen)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v6 0/2] net/rds: fix the probe cm_id lock ordering
Date: Wed,  2 Dec 2026 10:40:52 +0800
Organization: Usenet Network
Message-ID: <20261202024054.1945-1-chenaibing@cmss.chinamobile.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1870866"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:S6+1alz+H1+CApT6PbGNNwxu4Xc= sha256:5MbCHEDanrE+dAd7r4aVqbLwKwcCIbZ7i41rfKh362E=
	sha1:dj6GxoOHRHIvW/EBJ5FEbiCmaf4= sha256:rlB5vu7ceU/yryAPpVgGSSxZodWPDeUUl24JXogsCXs=
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 BB187117533; Wed,  2 Dec 2026 05:42:23 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.75
X-Spam-Status: No, score=-2.75 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
	URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key)
	reason="fail (body has been altered)" header.d=cmss.chinamobile.com
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 l-gGBSBuaLLl;
	Wed,  2 Dec 2026 05:42:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-375501-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=cmss.chinamobile.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 44DE91174BB; Wed,  2 Dec 2026 05:42:12 +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 810A12D5C8; Wed,  2 Dec 2026 02:41:37 +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=1796179263;
	b=s5nvBhBfy4cek/2eTvP1rRLFz03+crW8o6Yc07m4bVRmKUenjv6026h98EKOiT6zrcw3
	 xG7NHBNLxODIOB2vQR4q1/n0s/OAGbTobDepnYJIz5xaQlq54dE3NoR3RVLfq0kC1FXP6
	 DvSWO7NHynT1Ju31WMQz5BYTFIAngiUgZiW+q92HDOFKVDqlaX2gRUOYmmLuCcZOaDUzJ
	 F82O8jiufF0bRmTucfOZptJUh9VnzmMWTlGljyD6IbJc+ns8ZRWWwknpY7SRruDebjc8Z
	 TCpiWAGeNxlzpZguqBhUtW7XuUcBI5FnskpkAWcmtUNGcpLNxlTUD6Ma5liR8UAmQSg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796179263;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:X-RM-TagInfo:
	 X-RM-SPAM-FLAG:Received:X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:
	 Received:X-RM-TRANSID:From:To:Cc:Subject:Date:Message-ID:X-Mailer:
	 X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=jPuDGRsCFqZmfoZFIxabDqZReCaHQgf17psndGIaB/E=;
	b=PfH+ldwo9X/Ok9TqVOhs9jKfK6KY4G3JROiwbVEj1Hl4F3Fb3aVkj6tjM8Q8zby2JpQA
	 cHpubjitvw6R9E5W4Pu9QmTQOID5W5LSc+SCK6xX/X9n4SXIcvYmOqOCOi6ioaz6B2mGD
	 Vg+PcDHyEp896MS+3gQEBGReKPE9a+Se9H6hKqhgIr6DAT0F02XHJvTun9qHEVRJXA6zp
	 69OVZT4ndysn8Kgh3D0v5s6sWp9L78CaOnvDCgaCPGUmWbYm4hojhMKTSd5buH495PbWv
	 KY3bNVi9fYb+jKFYwjutAiqzXr4CAphFf0/zNpXSMVLNT2PmNwvosqoZf7wmXVD+KuQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=Bf2sdZ92;
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.com;
	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 4F746606A6AB;
	Wed,  2 Dec 2026 02:41:03 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=Bf2sdZ92
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=111.22.67.137
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796179262;
	b=f7eGcK4eMufGwbfr3QMEVptcGBqwDJ1ForPpHFL75Tjqer9s0fWKWd2+z78Lpj5eccAj
	 AtkoHWSyNGZa+gwpgfq8oZ7DZJ5xsw6shPVJsjyKH6CnzfyRXKvRVzBJshK1ebWeRyt14
	 kHqbDZYYI7JLYpcSCXOVuDnX7KwYxP47NnY76oqbhBCC19CBDcNtlbkZSh8yjEMfCPb/2
	 lLbXfPxpW9o++DlfUD4b1w3ew1ybe+lSDc9iYAgm3yEv21cjY+VpXZ6aAHEvu4cftHUtI
	 eGXRKTEhv9Lq+HrX8R73sb+b701sJQDOBNMX4JF2Ya2ueU6/5uSs0VZz9YJ1aMEs8dw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796179262;
	h=DMARC-Filter:DKIM-Signature:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:
	 X-RM-TRANSID:X-RM-TagInfo:X-RM-SPAM-FLAG:Received:X-RM-TRANSID:From:
	 To:Cc:Subject:Date:Message-ID:X-Mailer:MIME-Version:
	 Content-Transfer-Encoding;
	bh=jPuDGRsCFqZmfoZFIxabDqZReCaHQgf17psndGIaB/E=;
	b=mtDFfscotG5G5zk/jhNetg54p9XOhbZ3malx3u9+OFXHkK+m/w94f1d/dGdzn3XNnE8W
	 9z3JHQ74Tyy4yyuDDt/JMBtWEyXil+8RIurCrnQqHgQ2TPrmS3Tg/UZQUNlDG9Cqw3f3Z
	 Sq6d0UwFNhvzTuL/nJf7PyMJJlmR6Yw1PSMVzDymAyUdEa5x8uUriS6xxeFC2R9ZuzHL7
	 iax8pvzQf/bz/sJqNdp897f3h94ypvJpzolQdxbGs1I2gk1Lt6RiH9nIa5k5JZJrHxDkJ
	 Nv1xDXAPnBzfmXEysQHuc68ed6so9QMS2oG5HrFxNGbc53rTTf8jqVQb7f4ug5BUYPg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=cmss.chinamobile.com;
	spf=pass smtp.mailfrom=cmss.chinamobile.com;
	dkim=pass header.d=cmss.chinamobile.com header.i=@cmss.chinamobile.com header.a=rsa-sha256 header.s=default header.b=Bf2sdZ92;
	arc=none smtp.remote-ip=111.22.67.137
X-Received: from cmccmta4.chinamobile.com (cmccmta4.chinamobile.com [111.22.67.137])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 09AED606A339;
	Wed,  2 Dec 2026 02:40:59 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 09AED606A339
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cmss.chinamobile.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=cmss.chinamobile.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=cmss.chinamobile.com; s=default; l=0;
	h=from:subject:message-id:to:cc:mime-version;
	bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=;
	b=Bf2sdZ923JdNCwL6ieIdCfQAPN3Jamvw+8Ft5CSNMxxtlBAJkbTbOg0u3r32vuz5/2AvfNq9eD5MJ
	 g6tGgx923MkQz2zHvlYh3nTtQCT5J34DyplGw6cNIC7FHfA+j2yWGLoVf1jkcIvDrcYcapKlVjKv72
	 wir5AwjBo0S8zYjA=
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from spf.mail.chinamobile.com (unknown[10.188.0.87])
	by rmmx-syy-dmz-app04-12004 (RichMail) with SMTP id 2ee46b0f8539b60-2b779;
	Wed, 02 Dec 2026 10:40:57 +0800 (CST)
X-RM-TRANSID: 2ee46b0f8539b60-2b779
X-RM-TagInfo: emlType=0                                       
X-RM-SPAM-FLAG: 00000000
X-Received: from FHD-W7400297 (unknown[10.55.1.70])
	by rmsmtp-syy-appsvr08-12008 (RichMail) with SMTP id 2ee86b0f853742e-33f80;
	Wed, 02 Dec 2026 10:40:57 +0800 (CST)
X-RM-TRANSID: 2ee86b0f853742e-33f80
X-Cc: netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.50.1.windows.1
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