NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/48550: panic when accessing CDs



The following reply was made to PR kern/48550; it has been noted by GNATS.

From: Manuel Bouyer <bouyer%antioche.eu.org@localhost>
To: Martin Husemann <martin%duskware.de@localhost>
Cc: gnats-bugs%NetBSD.org@localhost, henning petersen 
<henning.petersen%t-online.de@localhost>
Subject: Re: kern/48550: panic when accessing CDs
Date: Thu, 20 Mar 2014 18:02:58 +0100

 On Wed, Mar 19, 2014 at 04:44:18PM +0100, Martin Husemann wrote:
 > As henning petersen pointed out in 48664, this is a side effect of gcc 4.8.
 > Actually it turns out that the scsipi_read_cd_cap_data structure is
 > misaligned on the stack (as it formally requires no alignement) by newer
 > gcc and scsipi_command() doesn't seem to like this.
 > 
 > This patch avoids that and makes the READ_CD_CAPACITY work:
 > 
 > --8<--
 > Index: scsipi_cd.h
 > ===================================================================
 > RCS file: /cvsroot/src/sys/dev/scsipi/scsipi_cd.h,v
 > retrieving revision 1.21
 > diff -u -r1.21 scsipi_cd.h
 > --- scsipi_cd.h      1 Apr 2009 12:19:04 -0000       1.21
 > +++ scsipi_cd.h      19 Mar 2014 15:35:33 -0000
 > @@ -285,7 +285,7 @@
 >  struct scsipi_read_cd_cap_data {
 >      u_int8_t addr[4];
 >      u_int8_t length[4];
 > -} __packed;
 > +} __packed __aligned(4);
 >  
 >  
 >  /* mod pages common to scsi and atapi */
 > 
 > -->8--
 > 
 > I'd suggest to add KASSERT() to scsipi_command() and check this conditions,
 > if this is expected behaviour. If not, we need to search deeper in there.
 > 
 > I'll commit the other parts (additonal initialization and sanity checks
 > anyway). Manuel, can you comment on this?
 
 This may be a limitation from the underlying driver.
 If this is the case other hardware structures needs to be audited too ...
 (or the underlying driver may need to do bounce-buffering if the
 buffer is not aligned, in case it comes from e.g. userland ?)
 
 -- 
 Manuel Bouyer <bouyer%antioche.eu.org@localhost>
      NetBSD: 26 ans d'experience feront toujours la difference
 --
 


Home | Main Index | Thread Index | Old Index