From owner-freebsd-fs@freebsd.org Sat Feb 9 23:28:28 2019 Return-Path: Delivered-To: freebsd-fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2BA0414D1BC2 for ; Sat, 9 Feb 2019 23:28:28 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 9EEE187AB9 for ; Sat, 9 Feb 2019 23:28:27 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 2169014D1BB5; Sat, 9 Feb 2019 23:28:25 +0000 (UTC) Delivered-To: fs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0ED1214D1BB3 for ; Sat, 9 Feb 2019 23:28:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2CC2E87A5A for ; Sat, 9 Feb 2019 23:28:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id C97DEA1D2 for ; Sat, 9 Feb 2019 23:28:19 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x19NSJiP058792 for ; Sat, 9 Feb 2019 23:28:19 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x19NSJFu058791 for fs@FreeBSD.org; Sat, 9 Feb 2019 23:28:19 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 235582] rpc_svc_gss / nfsd kernel panic Date: Sat, 09 Feb 2019 23:28:19 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: 11.2-RELEASE X-Bugzilla-Keywords: panic X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rmacklem@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: fs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-fs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Filesystems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 09 Feb 2019 23:28:28 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235582 --- Comment #10 from Rick Macklem --- Created attachment 201876 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D201876&action= =3Dedit fix race in ref counting of svc_rpc_gss_client struct Upon inspection I found two related races when the svc_rpc_gss_client structure in created/initialized. 1 - The cl_expiration field is set after the structure is linked into a list, making it visible to other threads when it is still 0. This could result in svc_rpc_gss_timeout_client() freeing it just after being linked into the list. 2 - Related to #1, cl_refs is initialized to 1 and then incremented by refcount_acquire() after svc_rpc_gss_create_client() returns it, leaving a window where cl_refs could be decremented to 0 and free'd. This patch makes two changes to svc_rpc_gss_create_client(): - Move the code that initializes cl_expiration to before where it is linked into the list, so that it is set before it is visible to other threads. - Initialize cl_refs to 2, so a refcount_acquire() is not needed after the svc_rpc_gss_create_client() call. These races could allow the structure to be free'd when it is still being used in svc_rpc_gss(). This patch can be applied separately from #201862. --=20 You are receiving this mail because: You are the assignee for the bug.=