From ilepore@damnhippie.dyndns.org  Fri Nov 11 17:46:31 2011
Return-Path: <ilepore@damnhippie.dyndns.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 968FF106566B
	for <freebsd-gnats-submit@freebsd.org>; Fri, 11 Nov 2011 17:46:31 +0000 (UTC)
	(envelope-from ilepore@damnhippie.dyndns.org)
Received: from qmta13.emeryville.ca.mail.comcast.net (qmta13.emeryville.ca.mail.comcast.net [76.96.27.243])
	by mx1.freebsd.org (Postfix) with ESMTP id 7BFBF8FC15
	for <freebsd-gnats-submit@freebsd.org>; Fri, 11 Nov 2011 17:46:31 +0000 (UTC)
Received: from omta04.emeryville.ca.mail.comcast.net ([76.96.30.35])
	by qmta13.emeryville.ca.mail.comcast.net with comcast
	id vtkc1h0020lTkoCADtmPkR; Fri, 11 Nov 2011 17:46:23 +0000
Received: from damnhippie.dyndns.org ([24.8.232.202])
	by omta04.emeryville.ca.mail.comcast.net with comcast
	id vthf1h0194NgCEG8Qthg5i; Fri, 11 Nov 2011 17:41:40 +0000
Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240])
	by damnhippie.dyndns.org (8.14.3/8.14.3) with ESMTP id pABHkSKg063627
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 11 Nov 2011 10:46:28 -0700 (MST)
	(envelope-from ilepore@damnhippie.dyndns.org)
Received: (from ilepore@localhost)
	by revolution.hippie.lan (8.14.5/8.14.4/Submit) id pABHkSjM021719;
	Fri, 11 Nov 2011 10:46:28 -0700 (MST)
	(envelope-from ilepore)
Message-Id: <201111111746.pABHkSjM021719@revolution.hippie.lan>
Date: Fri, 11 Nov 2011 10:46:28 -0700 (MST)
From: Ian Lepore <freebsd@damnhippie.dyndns.org>
Reply-To: Ian Lepore <freebsd@damnhippie.dyndns.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [patch] Cannot mount filesystem formatted by newfs_msdos on ARM 
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         162486
>Category:       bin
>Synopsis:       [patch] Cannot mount filesystem formatted by newfs_msdos on ARM
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    delphij
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Fri Nov 11 17:50:04 UTC 2011
>Closed-Date:    Tue Feb 07 21:57:40 UTC 2012
>Last-Modified:  Tue Feb  7 22:00:30 UTC 2012
>Originator:     Ian Lepore <freebsd@damnhippie.dyndns.org>
>Release:        FreeBSD 8.2-STABLE arm
>Organization:
Symmetricom, Inc.
>Environment:
FreeBSD tflex 8.2-STABLE FreeBSD 8.2-STABLE #29: Tue Oct 11 13:32:35 UTC 2011     root@revolution.hippie.lan:/usr/obj/arm/usr/src/sys/TFLEX  arm

>Description:
A filesystem formated with newfs_msdos on an ARM system cannot be mounted on
ARM or other architectures.  The problem turned out to be ARM ABI structure 
packing.  More information is available in this mail thread:

http://lists.freebsd.org/pipermail/freebsd-arm/2011-October/003106.html

>How-To-Repeat:

>Fix:

--- newfs_msdos.diff begins here ---
Index: sbin/newfs_msdos/newfs_msdos.c
===================================================================
RCS file: /local/base/FreeBSD-CVS/src/sbin/newfs_msdos/newfs_msdos.c,v
retrieving revision 1.37
diff -u -p -r1.37 newfs_msdos.c
--- sbin/newfs_msdos/newfs_msdos.c	12 Jul 2011 10:07:07 -0000	1.37
+++ sbin/newfs_msdos/newfs_msdos.c	11 Nov 2011 17:31:11 -0000
@@ -99,7 +99,7 @@ static const char rcsid[] =
 struct bs {
     u_int8_t bsJump[3];		/* bootstrap entry point */
     u_int8_t bsOemName[8];		/* OEM name and version */
-};
+} __packed;
 
 struct bsbpb {
     u_int8_t bpbBytesPerSec[2];		/* bytes per sector */
@@ -114,7 +114,7 @@ struct bsbpb {
     u_int8_t bpbHeads[2];		/* drive heads */
     u_int8_t bpbHiddenSecs[4];		/* hidden sectors */
     u_int8_t bpbHugeSectors[4];		/* big total sectors */
-};
+} __packed;
 
 struct bsxbpb {
     u_int8_t bpbBigFATsecs[4];		/* big sectors per FAT */
@@ -124,7 +124,7 @@ struct bsxbpb {
     u_int8_t bpbFSInfo[2];		/* file system info sector */
     u_int8_t bpbBackup[2];		/* backup boot sector */
     u_int8_t bpbReserved[12];			/* reserved */
-};
+} __packed;
 
 struct bsx {
     u_int8_t exDriveNumber;		/* drive number */
@@ -133,7 +133,7 @@ struct bsx {
     u_int8_t exVolumeID[4];		/* volume ID number */
     u_int8_t exVolumeLabel[11]; 	/* volume label */
     u_int8_t exFileSysType[8];		/* file system type */
-};
+} __packed;
 
 struct de {
     u_int8_t deName[11];	/* name and extension */
@@ -143,7 +143,7 @@ struct de {
     u_int8_t deMDate[2];	/* creation date */
     u_int8_t deStartCluster[2];	/* starting cluster */
     u_int8_t deFileSize[4];	/* size */
-};
+} __packed;
 
 struct bpb {
     u_int bpbBytesPerSec;		/* bytes per sector */
--- newfs_msdos.diff ends here ---

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->delphij 
Responsible-Changed-By: delphij 
Responsible-Changed-When: Fri Nov 11 20:24:07 UTC 2011 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162486 
State-Changed-From-To: open->patched 
State-Changed-By: delphij 
State-Changed-When: Fri Nov 11 20:31:58 UTC 2011 
State-Changed-Why:  
Committed against -HEAD, MFC reminder. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162486 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/162486: commit references a PR
Date: Fri, 11 Nov 2011 20:31:59 +0000 (UTC)

 Author: delphij
 Date: Fri Nov 11 20:31:48 2011
 New Revision: 227454
 URL: http://svn.freebsd.org/changeset/base/227454
 
 Log:
   Use __packed to prevent alignment from taking place, which otherwise may
   change the on-disk format in an incompatible way.  Without this change,
   msdosfs created on FreeBSD/arm would not be mountable.
   
   PR:		bin/162486
   Submitted by:	Ian Lepore <freebsd damnhippie dyndns org>
   Reported by:	Mattia Rossi <mrossi at swin.edu.au>
   MFC after:	3 days
 
 Modified:
   head/sbin/newfs_msdos/newfs_msdos.c
 
 Modified: head/sbin/newfs_msdos/newfs_msdos.c
 ==============================================================================
 --- head/sbin/newfs_msdos/newfs_msdos.c	Fri Nov 11 20:13:24 2011	(r227453)
 +++ head/sbin/newfs_msdos/newfs_msdos.c	Fri Nov 11 20:31:48 2011	(r227454)
 @@ -99,7 +99,7 @@ static const char rcsid[] =
  struct bs {
      u_int8_t bsJump[3];		/* bootstrap entry point */
      u_int8_t bsOemName[8];		/* OEM name and version */
 -};
 +} __packed;
  
  struct bsbpb {
      u_int8_t bpbBytesPerSec[2];		/* bytes per sector */
 @@ -114,7 +114,7 @@ struct bsbpb {
      u_int8_t bpbHeads[2];		/* drive heads */
      u_int8_t bpbHiddenSecs[4];		/* hidden sectors */
      u_int8_t bpbHugeSectors[4];		/* big total sectors */
 -};
 +} __packed;
  
  struct bsxbpb {
      u_int8_t bpbBigFATsecs[4];		/* big sectors per FAT */
 @@ -124,7 +124,7 @@ struct bsxbpb {
      u_int8_t bpbFSInfo[2];		/* file system info sector */
      u_int8_t bpbBackup[2];		/* backup boot sector */
      u_int8_t bpbReserved[12];			/* reserved */
 -};
 +} __packed;
  
  struct bsx {
      u_int8_t exDriveNumber;		/* drive number */
 @@ -133,7 +133,7 @@ struct bsx {
      u_int8_t exVolumeID[4];		/* volume ID number */
      u_int8_t exVolumeLabel[11]; 	/* volume label */
      u_int8_t exFileSysType[8];		/* file system type */
 -};
 +} __packed;
  
  struct de {
      u_int8_t deName[11];	/* name and extension */
 @@ -143,7 +143,7 @@ struct de {
      u_int8_t deMDate[2];	/* creation date */
      u_int8_t deStartCluster[2];	/* starting cluster */
      u_int8_t deFileSize[4];	/* size */
 -};
 +} __packed;
  
  struct bpb {
      u_int bpbBytesPerSec;		/* bytes per sector */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: delphij 
State-Changed-When: Tue Feb 7 21:57:14 UTC 2012 
State-Changed-Why:  
Patch applied against RELENG_8 and RELENG_9, thanks for 
your submission! 

http://www.freebsd.org/cgi/query-pr.cgi?pr=162486 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/162486: commit references a PR
Date: Tue,  7 Feb 2012 21:57:13 +0000 (UTC)

 Author: delphij
 Date: Tue Feb  7 21:56:58 2012
 New Revision: 231162
 URL: http://svn.freebsd.org/changeset/base/231162
 
 Log:
   MFC r227454:
   
   Use __packed to prevent alignment from taking place, which otherwise may
   change the on-disk format in an incompatible way. Without this change,
   msdosfs created on FreeBSD/arm would not be mountable.
   
   PR:		bin/162486
   Submitted by:	Ian Lepore <freebsd damnhippie dyndns org>
   Reported by:	Mattia Rossi <mrossi at swin.edu.au>
 
 Modified:
   stable/9/sbin/newfs_msdos/newfs_msdos.c
 Directory Properties:
   stable/9/sbin/newfs_msdos/   (props changed)
 
 Changes in other areas also in this revision:
 Modified:
   stable/8/sbin/newfs_msdos/newfs_msdos.c
 Directory Properties:
   stable/8/sbin/newfs_msdos/   (props changed)
 
 Modified: stable/9/sbin/newfs_msdos/newfs_msdos.c
 ==============================================================================
 --- stable/9/sbin/newfs_msdos/newfs_msdos.c	Tue Feb  7 20:54:44 2012	(r231161)
 +++ stable/9/sbin/newfs_msdos/newfs_msdos.c	Tue Feb  7 21:56:58 2012	(r231162)
 @@ -99,7 +99,7 @@ static const char rcsid[] =
  struct bs {
      u_int8_t bsJump[3];			/* bootstrap entry point */
      u_int8_t bsOemName[8];		/* OEM name and version */
 -};
 +} __packed;
  
  struct bsbpb {
      u_int8_t bpbBytesPerSec[2];		/* bytes per sector */
 @@ -114,7 +114,7 @@ struct bsbpb {
      u_int8_t bpbHeads[2];		/* drive heads */
      u_int8_t bpbHiddenSecs[4];		/* hidden sectors */
      u_int8_t bpbHugeSectors[4];		/* big total sectors */
 -};
 +} __packed;
  
  struct bsxbpb {
      u_int8_t bpbBigFATsecs[4];		/* big sectors per FAT */
 @@ -124,7 +124,7 @@ struct bsxbpb {
      u_int8_t bpbFSInfo[2];		/* file system info sector */
      u_int8_t bpbBackup[2];		/* backup boot sector */
      u_int8_t bpbReserved[12];		/* reserved */
 -};
 +} __packed;
  
  struct bsx {
      u_int8_t exDriveNumber;		/* drive number */
 @@ -133,7 +133,7 @@ struct bsx {
      u_int8_t exVolumeID[4];		/* volume ID number */
      u_int8_t exVolumeLabel[11]; 	/* volume label */
      u_int8_t exFileSysType[8];		/* file system type */
 -};
 +} __packed;
  
  struct de {
      u_int8_t deName[11];		/* name and extension */
 @@ -143,7 +143,7 @@ struct de {
      u_int8_t deMDate[2];		/* creation date */
      u_int8_t deStartCluster[2];		/* starting cluster */
      u_int8_t deFileSize[4];		/* size */
 -};
 +} __packed;
  
  struct bpb {
      u_int bpbBytesPerSec;		/* bytes per sector */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/162486: commit references a PR
Date: Tue,  7 Feb 2012 21:57:27 +0000 (UTC)

 Author: delphij
 Date: Tue Feb  7 21:56:58 2012
 New Revision: 231162
 URL: http://svn.freebsd.org/changeset/base/231162
 
 Log:
   MFC r227454:
   
   Use __packed to prevent alignment from taking place, which otherwise may
   change the on-disk format in an incompatible way. Without this change,
   msdosfs created on FreeBSD/arm would not be mountable.
   
   PR:		bin/162486
   Submitted by:	Ian Lepore <freebsd damnhippie dyndns org>
   Reported by:	Mattia Rossi <mrossi at swin.edu.au>
 
 Modified:
   stable/8/sbin/newfs_msdos/newfs_msdos.c
 Directory Properties:
   stable/8/sbin/newfs_msdos/   (props changed)
 
 Changes in other areas also in this revision:
 Modified:
   stable/9/sbin/newfs_msdos/newfs_msdos.c
 Directory Properties:
   stable/9/sbin/newfs_msdos/   (props changed)
 
 Modified: stable/8/sbin/newfs_msdos/newfs_msdos.c
 ==============================================================================
 --- stable/8/sbin/newfs_msdos/newfs_msdos.c	Tue Feb  7 20:54:44 2012	(r231161)
 +++ stable/8/sbin/newfs_msdos/newfs_msdos.c	Tue Feb  7 21:56:58 2012	(r231162)
 @@ -99,7 +99,7 @@ static const char rcsid[] =
  struct bs {
      u_int8_t bsJump[3];			/* bootstrap entry point */
      u_int8_t bsOemName[8];		/* OEM name and version */
 -};
 +} __packed;
  
  struct bsbpb {
      u_int8_t bpbBytesPerSec[2];		/* bytes per sector */
 @@ -114,7 +114,7 @@ struct bsbpb {
      u_int8_t bpbHeads[2];		/* drive heads */
      u_int8_t bpbHiddenSecs[4];		/* hidden sectors */
      u_int8_t bpbHugeSectors[4];		/* big total sectors */
 -};
 +} __packed;
  
  struct bsxbpb {
      u_int8_t bpbBigFATsecs[4];		/* big sectors per FAT */
 @@ -124,7 +124,7 @@ struct bsxbpb {
      u_int8_t bpbFSInfo[2];		/* file system info sector */
      u_int8_t bpbBackup[2];		/* backup boot sector */
      u_int8_t bpbReserved[12];		/* reserved */
 -};
 +} __packed;
  
  struct bsx {
      u_int8_t exDriveNumber;		/* drive number */
 @@ -133,7 +133,7 @@ struct bsx {
      u_int8_t exVolumeID[4];		/* volume ID number */
      u_int8_t exVolumeLabel[11]; 	/* volume label */
      u_int8_t exFileSysType[8];		/* file system type */
 -};
 +} __packed;
  
  struct de {
      u_int8_t deName[11];		/* name and extension */
 @@ -143,7 +143,7 @@ struct de {
      u_int8_t deMDate[2];		/* creation date */
      u_int8_t deStartCluster[2];		/* starting cluster */
      u_int8_t deFileSize[4];		/* size */
 -};
 +} __packed;
  
  struct bpb {
      u_int bpbBytesPerSec;		/* bytes per sector */
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
