From owner-freebsd-bugs@FreeBSD.ORG Mon Sep 6 04:20:05 2010 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74B8F10656CD for ; Mon, 6 Sep 2010 04:20:05 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 47E8C8FC15 for ; Mon, 6 Sep 2010 04:20:05 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id o864K5ld049853 for ; Mon, 6 Sep 2010 04:20:05 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id o864K5tR049852; Mon, 6 Sep 2010 04:20:05 GMT (envelope-from gnats) Resent-Date: Mon, 6 Sep 2010 04:20:05 GMT Resent-Message-Id: <201009060420.o864K5tR049852@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Wollman Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 99D9F10656DE for ; Mon, 6 Sep 2010 04:14:52 +0000 (UTC) (envelope-from wollman@hergotha.csail.mit.edu) Received: from hergotha.csail.mit.edu (hergotha.csail.mit.edu [66.92.79.170]) by mx1.freebsd.org (Postfix) with ESMTP id 4EC338FC1A for ; Mon, 6 Sep 2010 04:14:51 +0000 (UTC) Received: from hergotha.csail.mit.edu (localhost [127.0.0.1]) by hergotha.csail.mit.edu (8.14.4/8.14.4) with ESMTP id o864EopC046618 for ; Mon, 6 Sep 2010 00:14:50 -0400 (EDT) (envelope-from wollman@hergotha.csail.mit.edu) Received: (from wollman@localhost) by hergotha.csail.mit.edu (8.14.4/8.14.4/Submit) id o864EoNx046617; Mon, 6 Sep 2010 00:14:50 -0400 (EDT) (envelope-from wollman) Message-Id: <201009060414.o864EoNx046617@hergotha.csail.mit.edu> Date: Mon, 6 Sep 2010 00:14:50 -0400 (EDT) From: Garrett Wollman To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: kern/150315: sizeof(union ccb) changed between 7.x and 8.x X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Garrett Wollman List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Sep 2010 04:20:05 -0000 >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@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: