From nobody Tue Feb 21 00:42:03 2023 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 4PLL8W37dsz3sjHL; Tue, 21 Feb 2023 00:42:03 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PLL8W2byxz46yt; Tue, 21 Feb 2023 00:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676940123; 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=Dz+kOEnbHcMr3NwGTcEQrzON6AShjbfuq5zNlyN3Vpg=; b=gi/CzKJttKa2LvQEHGqFECS2k31j6grGfYY5ri0nnRKwb4MEy6h5d0B5o8DdqKRNOD58q9 LLtLgXLCC1q7IMTdnhdGMEvtci+6tjaj3R/KbZ5LfjpXgm5DttLEP2n7i/cJUI/1O/0Jv7 GhGJZ9HIfKL4PBAUi5f1IHBN7wVgiylwYOVJwc+BSojp/XPCzzfgQ465dcwmp2zgoa6KzN CfpToz+zPAtE7CHRx023mHlQLCIG4LbdgRD88MYSqdZiZuERGXNhXy7XqTO3kaAmnLFNbJ 5RvVg+QUsw0/e4WbCV2zkQfav/GGCq8Fnwaqeq+yvRgdlxi0+HPQgXYEyigxuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676940123; 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=Dz+kOEnbHcMr3NwGTcEQrzON6AShjbfuq5zNlyN3Vpg=; b=GS2R8zHQol+C0miPs7jucMj7ROTUhC9L5KAmwKk357si0FHI+A6sW37fMUdT4qSWz1lKpG mwxv3OzXf57gWb+M49TEHX8Zw7ksampc2BeedVUdPzutS6MNW+gC6nDwvF7Ualm5AVpPAu o2hPCRIkZt/zvx5tMP3gY5uitpHM9aUAxDn49O+FSLmClb5CNwsH6rmUk1q1LJtfEPmh1W FE1AU/rNoDa9g39ZkCB5nzYiWs6EK44/m9Pbe9v5Jok1wM7t56k++pbdkqtoxavIzvJDcY 8OOxtjSp7i6X3Zd12P4A8AWyBow2QCqFZKZI597VASfE7PJlPKTSbFgaTc4elA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676940123; a=rsa-sha256; cv=none; b=FWiD0Kfd34HatDbhhyfAYkCSsA3moemYyzrdOjO2BanJIV19zxASuEPb8gr6QVaPm7w9om jfxFfV6fcMY+Y1zyjdI2lofVaYPqIjvg4f6EtElomWXZ7usLe3wF44UpePzb3opMF3fjrG jb6BJoRBDWBJ0yPkc641wr2MLuxkCATTWeA3Zpkoo0zzi8ZiMUyoebg75Hk/B11g0sRoqT kMaQBTVMAJN2ofwZWkJGA+4yKymB434fwRoMSPZLFWjEanQp1engdA1LxVeaxRf85hBzsI zyap4V5jowiHzpCaFt0a+ZomFs7dRVKuEtkOhpr0+MPsJv4yRlN/60+PfCLxhA== 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 4PLL8W1h2Vz11NC; Tue, 21 Feb 2023 00:42:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31L0g3CT080546; Tue, 21 Feb 2023 00:42:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31L0g3PW080545; Tue, 21 Feb 2023 00:42:03 GMT (envelope-from git) Date: Tue, 21 Feb 2023 00:42:03 GMT Message-Id: <202302210042.31L0g3PW080545@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: 357492c99597 - main - nfscl: Add NFSD_CURVNET macros to nfsclient syscall 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: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: 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: 357492c99597d13bc966441f30bb44f6ef659f08 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=357492c99597d13bc966441f30bb44f6ef659f08 commit 357492c99597d13bc966441f30bb44f6ef659f08 Author: Rick Macklem AuthorDate: 2023-02-21 00:40:07 +0000 Commit: Rick Macklem CommitDate: 2023-02-21 00:40:07 +0000 nfscl: Add NFSD_CURVNET macros to nfsclient syscall Although the nfsclient syscall is used for client side, it does set up server side krpc for callbacks. As such, it needs to have the vnet set. This patch does this. Without this patch, the system would crash when the nfscbd(8) daemon was killed. Reported by: freebsd@walstatt-de.de MFC after: 3 months --- sys/fs/nfsclient/nfs_clport.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/sys/fs/nfsclient/nfs_clport.c b/sys/fs/nfsclient/nfs_clport.c index 7f9b18e9970a..7a47da3c07bf 100644 --- a/sys/fs/nfsclient/nfs_clport.c +++ b/sys/fs/nfsclient/nfs_clport.c @@ -1276,10 +1276,11 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) struct mount *mp; struct nfsmount *nmp; + NFSD_CURVNET_SET(NFSD_TD_TO_VNET(td)); if (uap->flag & NFSSVC_CBADDSOCK) { error = copyin(uap->argp, (caddr_t)&nfscbdarg, sizeof(nfscbdarg)); if (error) - return (error); + goto out; /* * Since we don't know what rights might be required, * pretend that we need them all. It is better to be too @@ -1288,10 +1289,11 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) error = fget(td, nfscbdarg.sock, cap_rights_init_one(&rights, CAP_SOCK_CLIENT), &fp); if (error) - return (error); + goto out; if (fp->f_type != DTYPE_SOCKET) { fdrop(fp, td); - return (EPERM); + error = EPERM; + goto out; } error = nfscbd_addsock(fp); fdrop(fp, td); @@ -1300,12 +1302,14 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) nfscl_enablecallb = 1; } } else if (uap->flag & NFSSVC_NFSCBD) { - if (uap->argp == NULL) - return (EINVAL); + if (uap->argp == NULL) { + error = EINVAL; + goto out; + } error = copyin(uap->argp, (caddr_t)&nfscbdarg2, sizeof(nfscbdarg2)); if (error) - return (error); + goto out; error = nfscbd_nfsd(td, &nfscbdarg2); } else if (uap->flag & NFSSVC_DUMPMNTOPTS) { error = copyin(uap->argp, &dumpmntopts, sizeof(dumpmntopts)); @@ -1391,6 +1395,8 @@ nfssvc_nfscl(struct thread *td, struct nfssvc_args *uap) } else { error = EINVAL; } +out: + NFSD_CURVNET_RESTORE(); return (error); }