From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=109.224.244.16 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795878853; b=sGgq7vlkgp28s6Hb1y9Z705HjZyahRwMMwmXd6wCJIkDWf9QIRy/to/+2b0uT2MhT0zD uCGfvkfP9gzwh95BUEIaM0RfQ9t9QVBFnmh0yeRY56GiX4lmoHKHRxm+oInX07KFQuENr fBZw3Jgu+Qn9jEwQVkFH1CoaBjPe+JmrkPVhGmnRw3q7TeApfxStk5VZWEI5JjdsHQJVd 1CdYCrd0B3AIiEhFqX53twDsYiRWXmivtt7jX0WIjiSlqESDNXOeBPUsxxx9Ogo1sFpZc vu6RCI6l6Zb3FijqsmjKQsBMSu+FR1oz/OkOuqbuVEE5vXZ+o4DzDi68QDkMgVHv0nw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795878853; h=DMARC-Filter:DKIM-Signature:Date:To:From:Cc:Subject:Message-ID: In-Reply-To:References:Feedback-ID:X-Pm-Message-ID:MIME-Version: Content-Type:Content-Transfer-Encoding; bh=E4k035P4dZcMi922utBpmYQuLblJtG64appdTUEPiyk=; b=d7vkAXOq1Et31FX7yYi4ZwqQ7t0KEg5G6oJasKlLA86vokouS3g1JJtZuKdpH33eEoLn o4eYtAGnCxU9J3zrVy2HAWZUJniK19GMgmEh+BfVn647ypSRggGpTdJ+FzVAJmjYYgFcB yTKSg00psDW6fW4tqRrjNknZX/AmF1Dsa2MsvRpI2jfjVU4DKvddmbh8+jrMoJc9aXfLo Y8UvIXUKS6B7F3lPA06s+u4yMjMp+rXlzz7sOYVURxjVkLbCQ8eFq0x69WYrZUBPlvUDc xfXMlw9DEHtpzJKgy3k06xHxu9TvpfnazVP1UCgYSeASCO8lc3y2uzEvbn9E/KDQEMg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=proton.me; spf=pass smtp.mailfrom=proton.me; arc=none smtp.remote-ip=109.224.244.16 Received: from mail-24416.protonmail.ch (mail-24416.protonmail.ch [109.224.244.16]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8F55606A31F; Sat, 28 Nov 2026 15:14:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D8F55606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=cz5erkleovdxxau5fl226y2e74.protonmail2; t=1795878839; x=1796138039; bh=E4k035P4dZcMi922utBpmYQuLblJtG64appdTUEPiyk=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=xJlqg7FzKWyvoyBtVA9jzDJ32K9iAHYM1y+c5WNzEA8+VhSWgzgZng2Kemua8OQbP +gTqcHV8GNUwO9YLS98I1omJDnrQnI2UpcWBbIXXt5oIEeUNeXWxsoVeAIQsMsnlmn r8ebmw7etARvx+fpeN+8jDTpfBmvUcoVRn5xgvRAoiuPdwEMPoa8wrK3aLgu53+0un Ml4jYMLpHJXHld7kd7RAujhBAlFVTNPz0S9MBB0jXrxjwlQTiwTQlbifS648b3dSJC YhmwwOoKn94mBqwtUdof3U8qSQ++F3wJzk6vmdCI/OEG1XZr+dwEGUdCxm1wtT9gZY Oxb5USh17a91A== Date: Sat, 28 Nov 2026 15:13:53 +0000 To: Sidraya Jayagond From: Bryam Vargas Cc: Dust Li , "David S . Miller" , Mahanta Jambigi , Paolo Abeni , Eric Dumazet , Jakub Kicinski , "D . Wythe" , Alexandra Winter , Hidayath Khan , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, netdev@vger.kernel.org, Simon Horman , Tony Lu , Wen Gu , linux-s390@vger.kernel.org, Wenjia Zhang , Julian Ruess Subject: Re: [PATCH net v2 2/2] net/smc: do not reuse the DMB of a nocopy device Message-ID: <20261128151348.1410275-1-hexlabsecurity@proton.me> In-Reply-To: <3b16c6c2-7bf1-4261-9c0c-abc56aa6d608@linux.ibm.com> References: <20261114-b4-disp-4e6374c2-v2-0-3b7050bddef7@proton.me> <20261114-b4-disp-4e6374c2-v2-2-3b7050bddef7@proton.me> <3b16c6c2-7bf1-4261-9c0c-abc56aa6d608@linux.ibm.com> Feedback-ID: 199661219:user:proton X-Pm-Message-ID: aba3765298940a73bf8eb074a709baca595bd67d X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, 19 Nov 2026 12:25:12 +0530, Sidraya Jayagond wrote: > I don't see what this branch buys us on this path. The link group is > already off its device list here, so no new connection can join it and > take the pooled DMB, and __smc_lgr_free_bufs() unregisters anything left > in lgr->rmbs[] at teardown anyway, neither race from the commit > message can happen on this path. Agreed, the unregister buys nothing there. v3 [1] drops it and leaves that DMB to the link group's free. > Could you point at the path that dereferences conn->rmb_desc after > smc_conn_free(), or drop the branch before it goes to stable? A client that calls connect() again on the same socket. When the handshake fails with a negative code the socket stays in SMC_INIT, and a later connect() runs the handshake again with the same smc_connection. conn->rmb_desc is still the first attempt's: always on net, and with 2/2 when that attempt was freed with its link group already off the list. If the retry then cannot allocate its RMB, smc_conn_free() runs in the new link group with that pointer: smc_ism_unset_conn() reads it and smc_buf_unuse() acts on it. On net smc_buf_unuse() then zeroes the freed buffer, 65568 bytes in the test, and clears ->used in the freed descriptor. With 2/2 and the pointer left set it unlinks and frees the descriptor. Measured on the loopback device with KASAN kernels and a non-blocking connect(): the second call returns ECONNABORTED and the third runs the handshake again. Three test knobs force the steps: the negative return of the first attempt, its link group terminated before the attempt is freed, and the failed RMB allocation of the retry. With kasan_multi_shot, net gives five UAF reports, the first in smc_ism_unset_conn(), and falls back to TCP. v1's 2/2, which had no branch, gives five as well, the first in the same place, then a GPF in smc_conn_free(), and close() hangs. v2 is clean, and so is v3. I haven't found a way to get there without the knobs. So v3 keeps only the clear on that path, WRITE_ONCE(conn->rmb_desc, NULL), and the commit message says what the retry does with the pointer. v6 2/3 of the CDC receive ordering series [2] clears both pointers in smc_conn_create(), which closes the stale use on net too; 2/2's clear is there so that this path doesn't need that patch in stable. [1] https://lore.kernel.org/all/20261128-b4-disp-2c190c90-v3-0-c566f64196c8= @proton.me/ [2] https://lore.kernel.org/all/20261112-b4-disp-1c8d3a53-v6-0-36a38ae35021= @proton.me/ Thanks, Bryam