mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
ktr: Use STAILQ_EMPTY_ATOMIC when checking for records in ktr_drain()
This is an unlocked check, and after commit34740937f7the debug checks in STAILQ_EMPTY may spuriously fail here. In particular, the per process queue is updated under the global ktrace mutex, not held in ktr_drain(). If a record is enqueued concurrently, the recording thread will schedule an AST to drain the queue again, so it should not be possible for a race to leave records in the queue indefinitely. Reviewed by: kib, olce Reported by: syzbot+d67eddd8c4923ee28bb7@syzkaller.appspotmail.com MFC after: 2 weeks Fixes:34740937f7("queue: New debug macros for STAILQ") Differential Revision: https://reviews.freebsd.org/D48899 (cherry picked from commit36631977d8)
This commit is contained in:
parent
0599d2a1c5
commit
ffb4d07771
1 changed files with 1 additions and 1 deletions
|
|
@ -396,7 +396,7 @@ ktr_drain(struct thread *td)
|
|||
|
||||
STAILQ_INIT(&local_queue);
|
||||
|
||||
if (!STAILQ_EMPTY(&td->td_proc->p_ktr)) {
|
||||
if (!STAILQ_EMPTY_ATOMIC(&td->td_proc->p_ktr)) {
|
||||
mtx_lock(&ktrace_mtx);
|
||||
STAILQ_CONCAT(&local_queue, &td->td_proc->p_ktr);
|
||||
mtx_unlock(&ktrace_mtx);
|
||||
|
|
|
|||
Loading…
Reference in a new issue