NetBSD Problem Report #44496

From hash@abox3.so-net.ne.jp  Mon Jan 31 06:41:29 2011
Return-Path: <hash@abox3.so-net.ne.jp>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id 22E3063B873
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 31 Jan 2011 06:41:29 +0000 (UTC)
Message-Id: <20110131153049.471C.17947C80@abox3.so-net.ne.jp>
Date: Mon, 31 Jan 2011 15:41:23 +0900
From: Takahiro HAYASHI <hash@abox3.so-net.ne.jp>
To: gnats-bugs@gnats.NetBSD.org
Subject: disklabel(8) with -r may break FreeBSD disklabel on i386/amd64

>Number:         44496
>Category:       bin
>Synopsis:       disklabel(8) with -r may break FreeBSD disklabel on i386/amd64
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 31 06:45:00 +0000 2011
>Closed-Date:    Thu Mar 24 02:37:13 +0000 2011
>Last-Modified:  Thu Mar 24 02:37:13 +0000 2011
>Originator:     Takahiro HAYASHI
>Release:        NetBSD-current 5.99.43
>Organization:
>Environment:
System: NetBSD halt 5.99.43 NetBSD 5.99.43 (HALT) #0: Thu Jan 6 16:38:37 JST 2011 root@halt:/usr/build2/obj.i386/sys/arch/i386/compile/HALT i386
Architecture: i386
Machine: i386
>Description:
	On i386 or amd64 port, disklabel(8) invoked with "-r" option
	does not distinguish FreeBSD's disklabel info from NetBSD's one
	because disklabel(8) is compiled with -DCOMPAT_386BSD_MBRPART.
	In case that FreeBSD is installed in prior MBR partition and
	NetBSD is installed in posterior MBR partition,  disklabel(8)
	finds FreeBSD's disklabel info and treats it as a NetBSD's one.
	So if you try to edit the NetBSD's disklabel info with -r,
	disklabel(8) will edit FreeBSD's one and break it.

	In i386 or amd64 kernel this compat option is commented out
	for years, so disklabel(8) should be compiled without
	COMPAT_386BSD_MBRPART if MACHINE==i386 or amd64.

>How-To-Repeat:
	1. carve up a disk to two MBR partitions
	2. install FreeBSD into former, install NetBSD into latter
	3. execute "disklabel -r" on NetBSD

>Fix:
	1. exclude CPPFLAGS+=-DCOMPAT_386BSD_MBRPART if i386 || amd64 
	   from sbin/disklabel/Makefile
	2. or resister NetBSD in prior MBR partition entry to FreeBSD.
	3. or use disklabel(8) without -r. Note that some options like -I
	   imply -r.

-- 
Takahiro HAYASHI <hash at abox3 dot so-net dot ne dot jp>

>Release-Note:

>Audit-Trail:
From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44496 CVS commit: src/sbin/disklabel
Date: Sat, 12 Feb 2011 22:23:02 +0000

 Module Name:	src
 Committed By:	dholland
 Date:		Sat Feb 12 22:23:02 UTC 2011

 Modified Files:
 	src/sbin/disklabel: Makefile

 Log Message:
 Disable COMPAT_386BSD_MBRPART. The code is still here if anyone needs it
 for some reason. (But I have no idea why that would be -- if you have one
 of these really ancient partitions and you're about to run disklabel, you
 can easily run fdisk first and change the partition type to NetBSD.)

 As it stands, the code will munch FreeBSD installs under some
 circumstances, which is really not acceptable behavior.

 The code, along with the kernel support that's been disabled by
 default for several years, and some related but less dangerous code in
 sysinst, should prboably be removed entirely after -6 is branched.

 Discussed on tech-kern and tech-userlevel; closes PR 44496.

 This is also almost certainly the cause of PR 42521 and PR 38841.


 To generate a diff of this commit:
 cvs rdiff -u -r1.66 -r1.67 src/sbin/disklabel/Makefile

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

State-Changed-From-To: open->pending-pullups
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 20 Feb 2011 00:29:30 +0000
State-Changed-Why:
pullup-5 #1561


From: "Jeff Rizzo" <riz@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/44496 CVS commit: [netbsd-5] src/sbin/disklabel
Date: Tue, 8 Mar 2011 17:05:32 +0000

 Module Name:	src
 Committed By:	riz
 Date:		Tue Mar  8 17:05:32 UTC 2011

 Modified Files:
 	src/sbin/disklabel [netbsd-5]: Makefile

 Log Message:
 Pull up following revision(s) (requested by dholland in ticket #1561):
 	sbin/disklabel/Makefile: revision 1.67
 Disable COMPAT_386BSD_MBRPART. The code is still here if anyone needs it
 for some reason. (But I have no idea why that would be -- if you have one
 of these really ancient partitions and you're about to run disklabel, you
 can easily run fdisk first and change the partition type to NetBSD.)
 As it stands, the code will munch FreeBSD installs under some
 circumstances, which is really not acceptable behavior.
 The code, along with the kernel support that's been disabled by
 default for several years, and some related but less dangerous code in
 sysinst, should prboably be removed entirely after -6 is branched.
 Discussed on tech-kern and tech-userlevel; closes PR 44496.
 This is also almost certainly the cause of PR 42521 and PR 38841.


 To generate a diff of this commit:
 cvs rdiff -u -r1.61 -r1.61.6.1 src/sbin/disklabel/Makefile

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

State-Changed-From-To: pending-pullups->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Thu, 24 Mar 2011 02:37:13 +0000
State-Changed-Why:
Pullup done a couple weeks ago. (I got behind on my netbsd-bugs mail. sigh)


>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-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.