Date: Fri, 3 Aug 2018 14:05:22 +0000 (UTC) From: Alan Somers <asomers@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r337242 - stable/11/sys/kern Message-ID: <201808031405.w73E5MrJ064610@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: asomers Date: Fri Aug 3 14:05:22 2018 New Revision: 337242 URL: https://svnweb.freebsd.org/changeset/base/337242 Log: MFC r336205: Don't acquire evclass_lock with a spinlock held When the "pc" audit class is enabled and auditd is running, witness will panic during thread exit because au_event_class tries to lock an rwlock while holding a spinlock acquired upstack by thread_exit. To fix this, move AUDIT_SYSCALL_EXIT futher upstack, before the spinlock is acquired. Of thread_exit's 16 callers, it's only necessary to call AUDIT_SYSCALL_EXIT from two, exit1 (for exiting processes) and kern_thr_exit (for exiting threads). The other callers are all kernel threads, which needen't call AUDIT_SYSCALL_EXIT because since they can't make syscalls there will be nothing to audit. And exit1 already does call AUDIT_SYSCALL_EXIT, making the second call in thread_exit redundant for that case. PR: 228444 Reported by: aniketp Reviewed by: aniketp, kib Differential Revision: https://reviews.freebsd.org/D16210 Modified: stable/11/sys/kern/kern_thr.c stable/11/sys/kern/kern_thread.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/kern/kern_thr.c ============================================================================== --- stable/11/sys/kern/kern_thr.c Fri Aug 3 14:03:50 2018 (r337241) +++ stable/11/sys/kern/kern_thr.c Fri Aug 3 14:05:22 2018 (r337242) @@ -375,6 +375,11 @@ kern_thr_exit(struct thread *td) KASSERT(p->p_numthreads > 1, ("too few threads")); racct_sub(p, RACCT_NTHR, 1); tdsigcleanup(td); + +#ifdef AUDIT + AUDIT_SYSCALL_EXIT(0, td); +#endif + PROC_SLOCK(p); thread_stopped(p); thread_exit(); Modified: stable/11/sys/kern/kern_thread.c ============================================================================== --- stable/11/sys/kern/kern_thread.c Fri Aug 3 14:03:50 2018 (r337241) +++ stable/11/sys/kern/kern_thread.c Fri Aug 3 14:05:22 2018 (r337242) @@ -533,9 +533,6 @@ thread_exit(void) SDT_PROBE0(proc, , , lwp__exit); KASSERT(TAILQ_EMPTY(&td->td_sigqueue.sq_list), ("signal pending")); -#ifdef AUDIT - AUDIT_SYSCALL_EXIT(0, td); -#endif /* * drop FPU & debug register state storage, or any other * architecture specific resources that
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201808031405.w73E5MrJ064610>