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@FreeBSD_head_ghuckriede:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 Additional Builds and Platforms: na Additional Information: na
I think we could simply extend the array to 32 bytes. The mutex name is grouped with other rarely-accessed fields at the end of the structure, and we will not waste a significant amount of memory relative to the total size of the structure.
A commit references this bug: Author: markj Date: Thu Apr 30 15:39:04 UTC 2020 New revision: 360498 URL: https://svnweb.freebsd.org/changeset/base/360498 Log: Increase the iflib txq callout mutex name length to 32 bytes. With a length of 16, the name ("<if name>:TX(<qid>):callout") typically gets truncated. PR: 245712 Reported by: ghuckriede@blackberry.com MFC after: 1 week Changes: head/sys/net/iflib.c
A commit references this bug: Author: markj Date: Thu May 7 14:49:18 UTC 2020 New revision: 360781 URL: https://svnweb.freebsd.org/changeset/base/360781 Log: MFC r360498: Increase the iflib txq callout mutex name length to 32 bytes. PR: 245712 Changes: _U stable/12/ stable/12/sys/net/iflib.c