https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=220037

            Bug ID: 220037
           Summary: [vfs] sys/kern/vfs_bio.c: a sleep-under-rwlock bug in
                    getblk
           Product: Base System
           Version: 11.0-RELEASE
          Hardware: i386
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: [email protected]
          Reporter: [email protected]

The kernel may sleep under a rwlock, and the function call path in file
"sys/kern/vfs_bio.c" in FreeBSD 11.0 is:
getblk [line 3498: acquire the rwlock by BO_RLOCK]
  bp_unmapped_get_kva [line 3582]
    bufspace_wait [line 3430]
      buf_flush [line 637] (rw_wunlock(&nblock) is called, but not BO_RUNLOCK)
        flushbufqueues [line 2977]
          malloc(M_WAITOK) [line 3093] --> may sleep

The possible fix of this bug is to set the last parameter "M_WAITOK" in malloc
to "M_NOWAIT".

This bug is found by a static analysis tool written by myself, and it is
checked by my review of the FreeBSD code.

By the way, I am a freshman in developing FreeBSD drivers, and I am willing to
submit a patch. But I do not know how to write and submit a patch, and where to
submit, so I am looking forward to useful advice :)

Jia-Ju Bai

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "[email protected]"

Reply via email to