From owner-freebsd-bugs Wed Mar 11 09:10:05 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA09320 for freebsd-bugs-outgoing; Wed, 11 Mar 1998 09:10:05 -0800 (PST) (envelope-from owner-freebsd-bugs@FreeBSD.ORG) Received: (from gnats@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA09308; Wed, 11 Mar 1998 09:10:02 -0800 (PST) (envelope-from gnats) Received: from gateman.zeus.leitch.com (gateman.zeus.leitch.com [204.187.61.193]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA08439 for ; Wed, 11 Mar 1998 09:03:34 -0800 (PST) (envelope-from woods@zeus.leitch.com) Received: from zeus.leitch.com (0@tap.zeus.leitch.com [204.187.61.10]) by gateman.zeus.leitch.com (8.8.5/8.7.3/1.0) with ESMTP id MAA09704 for ; Wed, 11 Mar 1998 12:03:31 -0500 (EST) Received: from bitter.zeus.leitch.com (bitter.zeus.leitch.com [204.187.61.66]) by zeus.leitch.com (8.7.5/8.7.3/1.0) with ESMTP id MAA15625 for ; Wed, 11 Mar 1998 12:03:25 -0500 (EST) Received: (woods@localhost) by bitter.zeus.leitch.com (8.8.7/8.6.9) id MAA02504; Wed, 11 Mar 1998 12:03:24 -0500 (EST) Message-Id: <199803111703.MAA02504@bitter.zeus.leitch.com> Date: Wed, 11 Mar 1998 12:03:24 -0500 (EST) From: woods@zeus.leitch.com Reply-To: woods@zeus.leitch.com To: FreeBSD-gnats-submit@FreeBSD.ORG X-Send-Pr-Version: 3.2 Subject: kern/5979: sd.c doesn't validate all mode sense 4 values, esp. secsize Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 5979 >Category: kern >Synopsis: sd.c doesn't validate all mode sense 4 values, esp. secsize >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Mar 11 09:10:01 PST 1998 >Last-Modified: >Originator: Greg A. Woods >Organization: Planix, Inc.; on contract at Leitch Technology International, Inc. >Release: FreeBSD 2.2.5-STABLE i386 >Environment: System: ASUS P2L97 motherboard with i686 class CPU and 128MB SDRAM SCSI Host Adapter: Adaptec AHA-2940UW (BIOS v1.32) Disk Array Controller: Adaptec AEC-4312A >Description: The sd driver probes and reports incorrect values from an Adaptec AEC-4312A SCSI RAID controller. Notably the sector size (and thus the calculated volume size) is invalid. This problem was initially noted in the 2.2.5-stable (RELENG_2_2 branch cvsup'ed as of 1998/01/26), but the latest 3.0-SNAP boot floppy also exhibited the same problem. >How-To-Repeat: Boot any FreeBSD on a system with an attached Adaptec AEC-4312A SCSI RAID array and inspect the sector size reported. >Fix: Upon inspection of and comparison with the NetBSD-1.3 release code, which does correctly identify bogus values from the mode sense and reports the correct sector size and calculated volume size using the traditional Adaptec "fictitious" geometry, we noted that the FreeBSD code was not clearing the scsi_sense data structure (presumably to allow detection of fields not set in the mode page), nor was the sector size being forced to a logical value when the rest of the geometry was corrected. The attached patch solves the problem (but we've not verified that all related problems have been solved -- the logic in NetBSD's version of this code is considerably different and seems to handle more potential conditions). === cd /usr/src/sys/scsi/ === /usr/bin/cvs diff -c sd.c Index: sd.c =================================================================== RCS file: /cvs/Leitch/FreeBSD-2.2/sys/scsi/sd.c,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 sd.c *** sd.c 1998/01/21 23:19:16 1.1.1.1 --- sd.c 1998/02/11 18:33:08 *************** *** 725,730 **** --- 725,731 ---- /* * do a "mode sense page 4" */ + bzero(&scsi_sense, sizeof(scsi_sense)); bzero(&scsi_cmd, sizeof(scsi_cmd)); scsi_cmd.op_code = MODE_SENSE; scsi_cmd.page = 4; *************** *** 791,796 **** --- 792,798 ---- disk_parms->heads = 64; disk_parms->cyls = sectors / (64 * 32); sectors = 32; + disk_parms->secsiz = SECSIZE; } /* keep secsiz sane too - we may divide by it later */ if(disk_parms->secsiz == 0) >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message