From nobody Thu Apr 9 09:18:44 2026 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4frvW84Yrzz6Ypcl for ; Thu, 09 Apr 2026 09:18:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4frvW83bpcz3LT5 for ; Thu, 09 Apr 2026 09:18:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775726324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IJtI4No4Sirtzd0MFB0h3tYp1SeZakPKyjCJE6Fa5W0=; b=ZFUvuo84cJU5Y07NJSoI2oSGKISIUr7sRA3BU5gr0fgi+/4KYEbWFTNT+Rj4gOq40gBdbP e0utqxd/q/8ns5xo7oTPpVLJeVst4t4iQADSfe09V844XtcxaJ35MF1Vo6FJ2bdfrjYFHB vauDc7dhakTbnh30AB0gE6vXCLeNWtxQrSyKX95Zgdji10/id9Wn6Q5H61NjlUr8wFGxCW JmQ1IYDxgNTO9LSTPUJWwFLmxyci0+r7KB3JxiyXhixd1xR0qjBqbqD/g4paKaXwUqy/2O W0DqRbdVcd3B4EAfMIpBl/4+bFLBeNhCbvOSsbJzngndBiRHhQ8HM5EuKdL/PQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1775726324; a=rsa-sha256; cv=none; b=TbvEyB9WaiUaWV6uGAH2xZlCCqdXHwiCfG+tuPY8CA/1w6gK7C4pn3KEpaNB+7w/hBlP1w Nq+qtiIyVn6kQxcxw/binUMtfoLS61/ukT0Wu5hRwbJ//hnlGDGLDd9QZHqe6dUoxrZmMF 1r2wsMdD4kWQRyV8iAD8S27dHSIdmqIhbNNw+NyRUdH33BZBqeYLtMSfrZ+YpNne12vo5o Utkkk/OpW/ooj0qidNzqB+rLknwWC1j7Akmpp5kdZNtALBEySnR7PluLf9KYmfVpJQpKHf 669oDsPfjrjJMHz1wIRGd9xN2qK9k/eS0xpLhmk4PqlPNJshbb1kT/AJHPKD/A== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1775726324; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=IJtI4No4Sirtzd0MFB0h3tYp1SeZakPKyjCJE6Fa5W0=; b=xcuGlZtFhrkcnK2U/hHJh6wiJUj7j3RLCGEgeNmK7zKqh8WIS5CbOE+P6DpaLmUis8H3L8 hTpdb363fg3ylVBwaLYpztMFhGxVh5k/zh6Z5D6YpdOv5zLHylLLVOLypVEU99G3ymmNQa 8WXyZg3B9AJyEuyRhVnn7eoSICnXVMQEb3hS9xt1zgrViok03DyW0eVUbtmG4CqrAtRMkS 6Tg2VPhDfgmAdfNXlaCV6e8BW+b15NWUklHg8drpDY1pS087ildzLyHtT9GVsU+n9UtYxs QhmFIAfg8wmt4sbsChSzTEElt+tGMtd3O9DfEjCdZwuEAP58ffCtjbwl7PptRA== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4frvW82stqz16cH for ; Thu, 09 Apr 2026 09:18:44 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 6399IiWo026927 for ; Thu, 9 Apr 2026 09:18:44 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 6399IiAH026926 for bugs@FreeBSD.org; Thu, 9 Apr 2026 09:18:44 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 294354] mfiutil(4)/mrsasutil(4): "show drives" truncates information Date: Thu, 09 Apr 2026 09:18:44 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 14.4-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: michaelo@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D294354 Bug ID: 294354 Summary: mfiutil(4)/mrsasutil(4): "show drives" truncates information Product: Base System Version: 14.4-STABLE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: michaelo@FreeBSD.org On: FreeBSD deblndw014x.innomotics.net 14.4-STABLE FreeBSD 14.4-STABLE c5e1dde24 GENERIC amd64 Consider this output: > # mrsasutil show drives > /dev/mrsas0 Physical Drives: > 4 ( 279G) JBOD = SAS E1:S13 > 5 ( 838G) JBOD SAS E1:S0 > 6 ( 838G) JBOD SAS E1:S1 > 7 ( 279G) JBOD = SAS E1:S14 > 8 ( 838G) JBOD SAS E1:S2 > 9 ( 279G) JBOD = SAS E1:S12 > 10 ( 838G) JBOD SAS E1:S3 > 11 ( 838G) JBOD SAS E1:S7 > 12 ( 838G) JBOD SAS E1:S4 > 13 ( 838G) JBOD SAS E1:S5 > 14 ( 838G) JBOD SAS E1:S6 > 15 ( 279G) JBOD = SAS E1:S15 On some disks the output looks weird and chopped off. Let's send a SCSI INQ= UIRY and double check: > root@deblndw014x:~ > # camcontrol cmd da3 -c "12 00 00 00 ff 00" -i 255 -v | hexdump -C > 00000000 00 00 05 12 8b 01 10 02 53 45 41 47 41 54 45 20 |........SEAG= ATE | > 00000010 53 54 39 33 30 30 36 30 35 53 53 20 20 20 20 20 |ST9300605SS = | > 00000020 35 31 30 31 36 58 50 33 46 34 59 48 00 00 00 00 |51016XP3F4YH= ....| > 00000030 40 23 38 37 39 38 30 00 00 00 00 00 00 00 00 00 |@#87980.....= ....| > 00000040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |............= ....| > * > 00000060 00 43 6f 70 79 72 69 67 68 74 20 28 63 29 20 32 |.Copyright (= c) 2| > 00000070 30 31 31 20 53 65 61 67 61 74 65 20 41 6c 6c 20 |011 Seagate = All | > 00000080 72 69 67 68 74 73 20 72 65 73 65 72 76 65 64 20 |rights reser= ved | > 00000090 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |............= ....| > * > 000000f0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |............= ...| > 000000ff The vendor-specific information is populated with the drive's S/N, followed= by four zeros and another identifier which is chopped off by the util. The bug is in mfi_drive.c: > const char * > mfi_pd_inq_string(struct mfi_pd_info *info) > { > struct scsi_inquiry_data iqd, *inq_data =3D &iqd; > char vendor[16], product[48], revision[16], rstr[12], serial[SID_VEND= OR_SPECIFIC_0_SIZE]; > static char inq_string[64]; >=20 > memcpy(inq_data, info->inquiry_data, > (sizeof (iqd) < sizeof (info->inquiry_data))? > sizeof (iqd) : sizeof (info->inquiry_data)); > if (SID_QUAL_IS_VENDOR_UNIQUE(inq_data)) > return (NULL); > if (SID_TYPE(inq_data) !=3D T_DIRECT) > return (NULL); > if (SID_QUAL(inq_data) !=3D SID_QUAL_LU_CONNECTED) > return (NULL); >=20 > cam_strvis(vendor, inq_data->vendor, sizeof(inq_data->vendor), > sizeof(vendor)); > cam_strvis(product, inq_data->product, sizeof(inq_data->product), > sizeof(product)); > cam_strvis(revision, inq_data->revision, sizeof(inq_data->revision), > sizeof(revision)); > cam_strvis(serial, (char *)inq_data->vendor_specific0, sizeof(inq_dat= a->vendor_specific0), > sizeof(serial)); >=20 > /* Hack for SATA disks, no idea how to tell speed. */ > if (strcmp(vendor, "ATA") =3D=3D 0) { > snprintf(inq_string, sizeof(inq_string), "<%s %s serial=3D%s> SAT= A", > product, revision, serial); > return (inq_string); > } >=20 > switch (SID_ANSI_REV(inq_data)) { > case SCSI_REV_CCS: > strcpy(rstr, "SCSI-CCS"); > break; > case 5: > strcpy(rstr, "SAS"); > break; > default: > snprintf(rstr, sizeof (rstr), "SCSI-%d", > SID_ANSI_REV(inq_data)); > break; > } > snprintf(inq_string, sizeof(inq_string), "<%s %s %s serial=3D%s> %s",= vendor, > product, revision, serial, rstr); > return (inq_string); > } >=20 As far as I understand the code one can first of all reuse SID_VENDOR_SIZE, SID_PRODUCT_SIZE, SID_REVISION_SIZE. Next cam_strvis() is a copy from CAM w= hich deviates from the actual CAM implementation. Since the current code escapes non-printable chars the buffer by SID_VENDOR_SPECIFIC_0_SIZE is quickly depleted. Yet another issue is that all strings created by cam_strvis() are NULL terminated, but are lacking the extra byte (at least serial). inq_stri= ng seems to small as well if we calculate SID_VENDOR_SIZE + SID_PRODUCT_SIZE + SID_REVISION_SIZE + SID_VENDOR_SPECIFIC_0_SIZE =3D 48 + 13 (other chars) = =3D 61 + rstr (11, but realistically 8) =3D 72 + null byte. Moreover, if we assume that the first three fields are always printable ASC= II, we can trim everything except, plus if we cast serial to char * we also ass= ume it to contain ASCII text although the SCSI spec says it is vendor specific, here we could just replace non-printable chars with space. --=20 You are receiving this mail because: You are the assignee for the bug.=