Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jun 2017 08:34:21 +0000
From:      bugzilla-noreply@freebsd.org
To:        freebsd-bugs@FreeBSD.org
Subject:   [Bug 220037] [vfs] sys/kern/vfs_bio.c: a sleep-under-rwlock bug in getblk
Message-ID:  <bug-220037-8@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help

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: freebsd-bugs@FreeBSD.org
          Reporter: baijiaju1990@163.com

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.


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-220037-8>