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: Martin Husemann <martin%duskware.de@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: Manuel Bouyer <bouyer%NetBSD.org@localhost>,
        henning petersen <henning.petersen%t-online.de@localhost>
Subject: Re: kern/48550: panic when accessing CDs
Date: Wed, 19 Mar 2014 16:44:18 +0100

 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?
 
 Martin
 


Home | Main Index | Thread Index | Old Index