From nobody Sat Jun 21 23:52:18 2025 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4bPrjv07XCz607yF; Sat, 21 Jun 2025 23:52:19 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bPrjt4Nxkz3DSQ; Sat, 21 Jun 2025 23:52:18 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750549938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ckIlRNcLy+TujX03RCL4/B6CqzapE13zFJLiBu9C6is=; b=UgoBg3G6weyKYexgEYjHj/ZyERpqO8wkGG8aQWMTPZpE5UuVH7jgLU5YjJeNMybO7qkBXT ilVI5MhyIGQWJySCPMUqlUXH6l2z36RU3cSTRviKSf4K12ohcmY9j1j4A+bWqb0N52v1xz Zns3FF/Bo0WtaPg2vsH1/rOVoXbbjLu+wxVmGrdFdcuKgwNhs4y9YvuaLgbN4ORwYlbvbP xBvR9gWuaypofM9x1yl2MZ0VcNILLs+LtXj8bB/h/es7sVaqStKyhiTCe8fcOFklL7QF+e CLL5yjURypieDMgPKpiyNROQDr2mmbaF8PwBRjucoNQFvShnFU1q9IGx0VawFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1750549938; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=ckIlRNcLy+TujX03RCL4/B6CqzapE13zFJLiBu9C6is=; b=ZZtygU1yWN1HONipZGQzEIxGXpesMTU6pK6SWIuds/rL2C+y31ch2TgM/8fiWz75xyAyUd Xsa9KtG+nJB8KH0FqAspburzuw6QFAY+fYiKiBarb4E0ajKnfTBMce+BULfUXYuaMASRnz atLgRKfZkOvWG/ewYZOqqHdMD/5ZWeJI7Md1C2Wj9U7upHtZ1G6JCnYDaprPUAq0Zki2tn KFFL+nxXKEErYTqLt6ol9TFQ9aNztp/JlFX6g6HbmwOv24iAKEFZV1PUxNdQLa0aS8aC+b iLKwJ8SWfL/4CUDSzCy7LZInI46477Z3TkNnYyyss28YY7zGMtjRuazPxNboCQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1750549938; a=rsa-sha256; cv=none; b=Tl9FodsY+vh2FxNKpoL51ICi1MA2Bby04aUh8YbjMS4mNGLAuT/bhizfohl/BqCvmYjqhZ 4KxBA+NMaqbDLlZlUB0sTwtpcsHhccucBUFE1BbC4MqlWqTf3ZmLSXR0MByOxWtXR6m55Z RcG8tWdQ2AemQA2UjjcO12s4QKz606FaZRDhDoSeooQLfcHqo3lwINJhjHE+1IdHJK9S9R NSDWsxeMgfqCOdmRRgHGfK2F/MrYvUP58etxJMuznhbw3Znrl1WN0oqzjdKnpy7+p7+zV/ amk7tQ4N+WrPcPMYaRCt0cK1GXp2Jv62g7AXt3aeWNLtT9mhJ+o7VJ4DkThzgA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bPrjt3y8czt10; Sat, 21 Jun 2025 23:52:18 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 55LNqIAM089147; Sat, 21 Jun 2025 23:52:18 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 55LNqIc5089144; Sat, 21 Jun 2025 23:52:18 GMT (envelope-from git) Date: Sat, 21 Jun 2025 23:52:18 GMT Message-Id: <202506212352.55LNqIc5089144@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Rick Macklem Subject: git: 26ee05939209 - main - rpctls_impl.c: Fix handling of socket for daemon failure List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 26ee0593920946646882a14997d15e16b1bec772 Auto-Submitted: auto-generated The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=26ee0593920946646882a14997d15e16b1bec772 commit 26ee0593920946646882a14997d15e16b1bec772 Author: Rick Macklem AuthorDate: 2025-06-21 23:49:13 +0000 Commit: Rick Macklem CommitDate: 2025-06-21 23:49:13 +0000 rpctls_impl.c: Fix handling of socket for daemon failure If the client side rpc.tlsclntd is not running when a NFS-over-TLS connection attempt is made, the socket is left open. This results in the rpc.tlsservd daemon on the NFS server being stuck in SSL_accept() until the daemon is restarted. This patch fixes this by doing soclose() on the socket for the cases where the daemon has not acquired the socket. Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D50961 --- sys/rpc/rpcsec_tls/rpctls_impl.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/rpc/rpcsec_tls/rpctls_impl.c b/sys/rpc/rpcsec_tls/rpctls_impl.c index 6745a04e8ac8..93fe283e65fd 100644 --- a/sys/rpc/rpcsec_tls/rpctls_impl.c +++ b/sys/rpc/rpcsec_tls/rpctls_impl.c @@ -181,6 +181,12 @@ sys_rpctls_syscall(struct thread *td, struct rpctls_syscall_args *uap) return (EPERM); } if ((error = falloc(td, &fp, &fd, 0)) != 0) { + /* + * The socket will not be acquired by the daemon, + * but has been removed from the upcall socket RB. + * As such, it needs to be closed here. + */ + soclose(ups.so); KRPC_CURVNET_RESTORE(); return (error); } @@ -223,13 +229,11 @@ rpctls_rpc_failed(struct upsock *ups, struct socket *so) mtx_unlock(&rpctls_lock); MPASS(removed == ups); /* - * Do a shutdown on the socket, since the daemon is - * probably stuck in SSL_accept() trying to read the - * socket. Do not soclose() the socket, since the - * daemon will close() the socket after SSL_accept() - * returns an error. + * Since the socket was still in the RB tree when + * this function was called, the daemon will not + * close it. As such, it needs to be closed here. */ - soshutdown(so, SHUT_RD); + soclose(so); } else { /* * The daemon has taken the socket from the tree, but