NetBSD-Bugs archive

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

install/55384: sysinst doesn't handle MD pm->ptstart value to reserve sectors



>Number:         55384
>Category:       install
>Synopsis:       sysinst doesn't handle MD pm->ptstart value to reserve sectors
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jun 13 14:25:00 +0000 2020
>Originator:     Izumi Tsutsui
>Release:        NetBSD 9.0
>Organization:
>Environment:
System: NetBSD mirage 9.0 NetBSD 9.0 (GENERIC) #23: Wed May 13 04:08:16 JST 2020 tsutsui@mirage:/s/netbsd-9/src/sys/arch/i386/compile/GENERIC i386
Architecture: maybe all
Machine: ports on (pm->start != 0) in sysinst/arch/*/md.c
>Description:
In NetBSD 8.x days sysinst has a value "pm->ptstart" and it is set
in MD md_get_info() in src/usr.sbin/sysinst/arch/*/md.c.

It's used to reserve sectors at the top of the target disk
for bootstrap or to store MD partition info etc.

MI make_bsd_partitions() in src/usr.sbin/sysinst/bsddisklabel.c
adjust all partitions using the pm->ptstart to locate all partitions
after pt->ptstart:

 https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/bsddisklabel.c?r=1.2.20.2#701
---
    701 		if (valid_part >= 0 && pm->oldlabel[valid_part].pi_offset < pm->ptstart) {
    702 			pm->oldlabel[valid_part].pi_offset = pm->ptstart;
    703 			pm->oldlabel[valid_part].pi_size -= pm->ptstart;
    704 		}

 :

    741 	if (layoutkind == LY_SETNEW)
    742 		get_ptn_sizes(partstart, ptend - partstart, no_swap);
---

However in NetBSD 9.0 pm->ptstart no longer used to adjust
start sector of partitions. It's just used to check
partition info returned from partition dependent(?)
get_part_info() functions.

 https://nxr.netbsd.org/xref/src/usr.sbin/sysinst/bsddisklabel.c?r=1.23.2.10#1039
---
   1039 		if (info.nat_type->generic_ptype != PT_swap &&
   1040 		    (info.start < ptstart ||
   1041 		    (info.start + info.size) > (ptstart+ptsize)))
   1042 			continue;
---

>How-To-Repeat:
Install NetBSD/x68k 9.0 (with fixes in PR/55187 and PR/55375).

The default partition settings show the root partition starts
from sector 0 so later newfs overwrite necessary partition info
and bootloaders.

Maybe other pm->ptstart != 0 ports (acorn32 and mvme68k?) are affected.

>Fix:
No idea which function should handle pm->ptstart restriction.

I've tried to fix fill_defaults(), apply_settings_to_partitions(),
sort_and_sync_parts(), merge_part_with_wanted() etc. but I get
no success. and give up to see partition independent abstraction layer.

---
Izumi Tsutsui



Home | Main Index | Thread Index | Old Index