[Bug 220074] [kern] sys/kern/kern_prot.c: a sleep-under-mutex bug in crextend

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Jun 17 06:54:17 UTC 2017


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

            Bug ID: 220074
           Summary: [kern] sys/kern/kern_prot.c: a sleep-under-mutex bug
                    in crextend
           Product: Base System
           Version: 11.0-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: baijiaju1990 at 163.com

The kernel may sleep under a mutex, and the function call path in file
"sys/kern/kern_prot.c" is:
sys_setuid [line 502: acquire the mutex]
  crcopysafe [line 506]
    crcopy [line 1991]
      crsetgroups [line 1892]
        crextend [line 2081]
          malloc(M_WAITOK) [line 2032] --> may sleep

The possible fix of this bug is to replace "M_WAITOK" in malloc with
"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.

Jia-Ju Bai

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list