Date: Sat, 09 Feb 2019 23:28:19 +0000 From: bugzilla-noreply@freebsd.org To: fs@FreeBSD.org Subject: [Bug 235582] rpc_svc_gss / nfsd kernel panic Message-ID: <bug-235582-3630-dqjr9ssoZJ@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-235582-3630@https.bugs.freebsd.org/bugzilla/> References: <bug-235582-3630@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D235582 --- Comment #10 from Rick Macklem <rmacklem@FreeBSD.org> --- 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.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-235582-3630-dqjr9ssoZJ>