NetBSD Problem Report #47463

From msaitoh@execsw.org  Fri Jan 18 02:18:48 2013
Return-Path: <msaitoh@execsw.org>
Received: from mail.netbsd.org (mail.netbsd.org [149.20.53.66])
	by www.NetBSD.org (Postfix) with ESMTP id 2378C63E933
	for <gnats-bugs@gnats.NetBSD.org>; Fri, 18 Jan 2013 02:18:48 +0000 (UTC)
Message-Id: <20130118021845.4997943985B@vslock.execsw.org>
Date: Fri, 18 Jan 2013 11:18:45 +0900 (JST)
From: msaitoh@execsw.org
Reply-To: msaitoh@execsw.org
To: gnats-bugs@gnats.NetBSD.org
Subject: ARM's disksubr_mbr.c is broken for non MBR disk.
X-Send-Pr-Version: 3.95

>Number:         47463
>Category:       port-arm
>Synopsis:       ARM's disksubr_mbr.c is broken for non MBR disk.
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    msaitoh
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jan 18 02:20:00 +0000 2013
>Closed-Date:    Tue Sep 08 09:09:58 +0000 2015
>Last-Modified:  Tue Sep 08 09:09:58 +0000 2015
>Originator:     SAITOH Masanobu
>Release:        6.0
>Organization:
>Environment:
arm ports which uses arm/arm/disksubr_mbr.c
>Description:
	 Many ARM ports use their own function in arm/arm/disksubr_mbr.c
	to check MBR partition table instead of kern/subr_disk_mbr.c.
	It's hard to know perfectly whether the first sector is the MBR
	or normal boot sector but MI subr_disk_mbr.c is not so bad.
	For ARM dissubr_mbr.c, it's very poor to check whether the first
	sector is MBR or not. It checks only whether the last two bytes
	(offset 0x1fe - 0x1ff) has the magic number.

	  We should check each partition table like MI subr_disk_mbr.c
	 or switch to use it.
>How-To-Repeat:
	Inset USB FLASH memory which hash no MBR and use disklabel.
>Fix:
	Sync with kern/subr_disk_mbr.c or switch to use kern/subr_disk_mbr.c

>Release-Note:

>Audit-Trail:
From: Masanobu SAITOH <msaitoh@execsw.org>
To: gnats-bugs@NetBSD.org
Cc: port-arm-maintainer@netbsd.org, gnats-admin@netbsd.org, 
 netbsd-bugs@netbsd.org, msaitoh@execsw.org
Subject: Re: port-arm/47463: ARM's disksubr_mbr.c is broken for non MBR disk.
Date: Fri, 18 Jan 2013 11:33:57 +0900

 Bad Example:
 > # disklabel sd0
 > # /dev/rsd0c:
 > type: SCSI
 > disk: USB2FlashStorage
 > label: fictitious-MBR
 > flags: removable
 > bytes/sector: 512
 > sectors/track: 32
 > tracks/cylinder: 8
 > sectors/cylinder: 256
 > cylinders: 500
 > total sectors: 15794176
 > rpm: 3600
 > interleave: 1
 > trackskew: 0
 > cylinderskew: 0
 > headswitch: 0           # microseconds
 > track-to-track seek: 0  # microseconds
 > drivedata: 0
 > 
 > 8 partitions:
 > #        size    offset     fstype [fsize bsize cpg/sgs]
 >  c:  15794176         0     unused      0     0        # (Cyl.      0 -  61695)
 >  e: 1851859059 1936028272    unknown                     # (Cyl. 7562610+- 14796434+)
 >  f: 538976288 1330184192    unknown                     # (Cyl. 5196032+- 7301408+)
 >  g: 1398362912 538989391    unknown                     # (Cyl. 2105427+- 7567782+)
 >  h:     21337 1394627663    unknown                     # (Cyl. 5447764+- 5447847+)
 > disklabel: boot block size 0
 > disklabel: super block size 0
 > disklabel: partition e: offset past end of unit
 > disklabel: partition e: partition extends past end of unit
 > disklabel: partitions e and g overlap
 > disklabel: partition f: offset past end of unit
 > disklabel: partition f: partition extends past end of unit
 > disklabel: partitions f and g overlap
 > disklabel: partitions f and h overlap
 > disklabel: partition g: offset past end of unit
 > disklabel: partition g: partition extends past end of unit
 > disklabel: partitions g and h overlap
 > disklabel: partition h: offset past end of unit
 > disklabel: partition h: partition extends past end of unit
 > #



 -- 
 -----------------------------------------------
                 SAITOH Masanobu (msaitoh@execsw.org
                                  msaitoh@netbsd.org)

From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47463 CVS commit: src/sys/arch/arm/arm
Date: Fri, 18 Jan 2013 02:46:31 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Fri Jan 18 02:46:31 UTC 2013

 Modified Files:
 	src/sys/arch/arm/arm: disksubr_mbr.c

 Log Message:
 PR#47463:
  - Check each mbrp_type field in fdisk partition table in MBR to know whether
    a sector is really MBR or not. Same as MI subr_disk_mbr.c
  - Check whether each number in a partition table is out of bound or not.
    Same as MI subr_disk_mbr.c
  - Update d_packname and d_npartitions if we found any partitions.
  - Currently, the exended partitions is not supported...


 To generate a diff of this commit:
 cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/arm/disksubr_mbr.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

Responsible-Changed-From-To: port-arm-maintainer->msaitoh
Responsible-Changed-By: msaitoh@NetBSD.org
Responsible-Changed-When: Fri, 18 Jan 2013 02:53:13 +0000
Responsible-Changed-Why:
Mine.


State-Changed-From-To: open->analyzed
State-Changed-By: msaitoh@NetBSD.org
State-Changed-When: Fri, 18 Jan 2013 02:53:13 +0000
State-Changed-Why:
I know.


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/47463 CVS commit: [netbsd-6] src/sys/arch/arm/arm
Date: Sun, 10 Feb 2013 20:17:23 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Sun Feb 10 20:17:23 UTC 2013

 Modified Files:
 	src/sys/arch/arm/arm [netbsd-6]: disksubr_mbr.c

 Log Message:
 Pull up following revision(s) (requested by msaitoh in ticket #804):
 	sys/arch/arm/arm/disksubr_mbr.c: revision 1.15
 Change for non MBR disk (PR#47463):
   - Check each mbrp_type field in fdisk partition table in MBR to know whether
     a sector is really MBR or not. Same as MI subr_disk_mbr.c
   - Check whether each number in a partition table is out of bound or not.
     Same as MI subr_disk_mbr.c
   - Update d_packname and d_npartitions if we found any partitions.
   - Currently, the exended partitions is not supported...


 To generate a diff of this commit:
 cvs rdiff -u -r1.13.4.1 -r1.13.4.2 src/sys/arch/arm/arm/disksubr_mbr.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: analyzed->feedback
State-Changed-By: martin@NetBSD.org
State-Changed-When: Fri, 23 Jan 2015 19:28:13 +0000
State-Changed-Why:
This is fixed, isn't it?


From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-arm/47463 (ARM's disksubr_mbr.c is broken for non MBR disk.)
Date: Fri, 23 Jan 2015 20:50:59 +0100

 On Fri, Jan 23, 2015 at 07:28:13PM +0000, martin@NetBSD.org wrote:
 > Synopsis: ARM's disksubr_mbr.c is broken for non MBR disk.
 > 
 > State-Changed-From-To: analyzed->feedback
 > State-Changed-By: martin@NetBSD.org
 > State-Changed-When: Fri, 23 Jan 2015 19:28:13 +0000
 > State-Changed-Why:
 > This is fixed, isn't it?

 acorn26 and acorn32 still use it, all other ARM ports use the generic
 version.

 Joerg

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-arm/47463 (ARM's disksubr_mbr.c is broken for non MBR disk.)
Date: Sat, 14 Feb 2015 10:49:15 +0000

 On Fri, Jan 23, 2015 at 07:55:01PM +0000, Joerg Sonnenberger wrote:
  >  On Fri, Jan 23, 2015 at 07:28:13PM +0000, martin@NetBSD.org wrote:
  >  > Synopsis: ARM's disksubr_mbr.c is broken for non MBR disk.
  >  > 
  >  > State-Changed-From-To: analyzed->feedback
  >  > State-Changed-By: martin@NetBSD.org
  >  > State-Changed-When: Fri, 23 Jan 2015 19:28:13 +0000
  >  > State-Changed-Why:
  >  > This is fixed, isn't it?
  >  
  >  acorn26 and acorn32 still use it, all other ARM ports use the generic
  >  version.

 I think the question was whether the changes to it already made fix
 the problem.

 -- 
 David A. Holland
 dholland@netbsd.org

From: Joerg Sonnenberger <joerg@britannica.bec.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: port-arm/47463 (ARM's disksubr_mbr.c is broken for non MBR disk.)
Date: Sun, 15 Feb 2015 16:36:41 +0100

 On Sat, Feb 14, 2015 at 10:50:01AM +0000, David Holland wrote:
 > The following reply was made to PR port-arm/47463; it has been noted by GNATS.
 > 
 > From: David Holland <dholland-bugs@netbsd.org>
 > To: gnats-bugs@NetBSD.org
 > Cc: 
 > Subject: Re: port-arm/47463 (ARM's disksubr_mbr.c is broken for non MBR disk.)
 > Date: Sat, 14 Feb 2015 10:49:15 +0000
 > 
 >  On Fri, Jan 23, 2015 at 07:55:01PM +0000, Joerg Sonnenberger wrote:
 >   >  On Fri, Jan 23, 2015 at 07:28:13PM +0000, martin@NetBSD.org wrote:
 >   >  > Synopsis: ARM's disksubr_mbr.c is broken for non MBR disk.
 >   >  > 
 >   >  > State-Changed-From-To: analyzed->feedback
 >   >  > State-Changed-By: martin@NetBSD.org
 >   >  > State-Changed-When: Fri, 23 Jan 2015 19:28:13 +0000
 >   >  > State-Changed-Why:
 >   >  > This is fixed, isn't it?
 >   >  
 >   >  acorn26 and acorn32 still use it, all other ARM ports use the generic
 >   >  version.
 >  
 >  I think the question was whether the changes to it already made fix
 >  the problem.

 It fixes the problems I have seen.

 Joerg

State-Changed-From-To: feedback->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Tue, 08 Sep 2015 09:09:58 +0000
State-Changed-Why:
fixed.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2014 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.