NetBSD-Bugs archive

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

bin/44496: 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:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Jan 31 06:45:00 +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>



Home | Main Index | Thread Index | Old Index