[Bug 245712] iflib: ift_mtx_name is too small

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Apr 17 21:27:53 UTC 2020


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

            Bug ID: 245712
           Summary: iflib: ift_mtx_name is too small
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: kern
          Assignee: bugs at FreeBSD.org
          Reporter: ghuckriede at blackberry.com

Overview:

'ift_mtx_name'
https://svnweb.freebsd.org/base/head/sys/net/iflib.c?annotate=359436#l362 has
size of 16 bytes

When it is initialized
https://svnweb.freebsd.org/base/head/sys/net/iflib.c?annotate=359436#l5522 the
format string "%s:TX(%d):callout" already uses 14 of those bytes (including the
NULL terminator).  This leaves 2 bytes for the 'nameunit' string and the
'ift_id' number, which clearly is not enough.

I see 2 possible fixes:
1. Increase the 'ift_mtx_name' array size ('nameunit' is not really a fixed
size, so how much?).
2. Change 'ift_mtx_name' to a pointer and alloc an appropriately sized string,
and free it on destroy.

Actual Results:
'ift_mtx_name' is truncated even in the best case (i.e. 2 character interface
name).
e.g. "em0:TX(0):callo"


Expected Results:
No truncation.

Build Date & Hardware:
# uname -a
FreeBSD FreeBSD_head_ghuckriede 13.0-CURRENT FreeBSD 13.0-CURRENT #2 r360017:
Fri Apr 17 11:16:38 EDT 2020
ghuckriede at FreeBSD_head_ghuckriede:/usr/obj/usr/src/amd64.amd64/sys/GENERIC 
amd64

Additional Builds and Platforms:
na

Additional Information:
na

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


More information about the freebsd-bugs mailing list