Subject: kern/34689: ata driver doesn't like odd addresses/lengths
To: None <kern-bug-people@netbsd.org, gnats-admin@netbsd.org,>
From: None <reinoud@NetBSD.org>
List: netbsd-bugs
Date: 10/01/2006 18:50:00
>Number:         34689
>Category:       kern
>Synopsis:       ata driver doesn't like odd addresses/lengths
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Oct 01 18:50:00 +0000 2006
>Originator:     Reinoud Zandijk
>Release:        NetBSD 4.0_BETA
>Organization:
	
>Environment:
	
	
System: NetBSD rangerover 4.0_BETA NetBSD 4.0_BETA (GENERIC) #2: Sun Oct 1 14:22:50 CEST 2006 reinoud@heethoofdje.kasbah:/usr/tmp/heethoofdje.obj/sys/arch/sparc/compile/GENERIC sparc
Architecture: sparc
Machine: sparc
>Description:

When issueing SCSI calls using scsipi() in-kernel to an atapi CD, both the
SCSI command and its resulting datablock need to be on an *EVEN* address and
having an *EVEN* length.

SCSI calls however can be odd in length and stack allocated memory for command
and return buffers can get odd addresses in gcc 4.1 where they got even
addresses in gcc 3.

The result is a silent byte-drop i.e. datastructures are returned without
their first byte or truncated.

	
>How-To-Repeat:
When calling SCSI calls from userland, the result block is word aligned so all
goes well.

When calling from kernel context, the result block can be odd aligned and fail
silently only to result in wierd errors later by code reading out gibberish.

	
>Fix:
Fix the ata driver to allow odd offsets and lengths. AFAIK the current ata
uses bus_space_*16 to transfer data without taking special care of either the
first or the last byte.

	

>Unformatted: