kern/150315: sizeof(union ccb) changed between 7.x and 8.x

Garrett Wollman wollman at FreeBSD.org
Mon Sep 6 04:20:05 UTC 2010


>Number:         150315
>Category:       kern
>Synopsis:       sizeof(union ccb) changed between 7.x and 8.x
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 06 04:20:04 UTC 2010
>Closed-Date:
>Last-Modified:
>Originator:     Garrett Wollman
>Release:        FreeBSD 8.1-RELEASE amd64
>Organization:
FreeBSD Project
>Environment:
System: FreeBSD hergotha.csail.mit.edu 8.1-RELEASE FreeBSD 8.1-RELEASE #0 r212140M: Sat Sep 4 00:16:21 EDT 2010 wollman at hergotha.csail.mit.edu:/usr/obj/usr/src/sys/HERGOTHA amd64

>Description:

sizeof(union ccb) changed when ATA support was added to the CAM
framework in the 8.x branch.  However, the CAMIOCOMMAND ioctl request,
used by many userland utilities that send direct SCSI commands, takes
a "union ccb" as its argument; this encodes sizeof(union ccb) into the
ioctl number and breaks binary compatibility between 7.x and 8.x for
these tools, even when COMPAT_FREEBSD7 is defined in the kernel
configuration.

This may be the same problem was originally reported in misc/138622,
which does not appear to have garnered any responses.

>How-To-Repeat:

Try to run any 7.x program which uses CAMIOCOMMAND to send SCSI
commands directly to devices (e.g., smartctl) and watch it fail
mysteriously when ioctl returns [ENOTTY].

>Fix:

It's not clear to me whether there's a good fix here.  The best fix
would be to define a (private) "union occb" and OCAMIOCOMMAND ioctl
which is compatible with 7.x, but I'm not sure if that's actually safe
to do when there are ATA devices actually in use.  Possibly just
recognizing the generic form of CAMIOCOMMAND and logging a
"CAMIOCOMMAND used with wrong size CCB" to the console would be a
stopgap if it's not practical to implement full compatability.
>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list