NetBSD Problem Report #60334

From www@netbsd.org  Mon Jun 15 08:33:05 2026
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.netbsd.org", Issuer "R13" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 896CB1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 15 Jun 2026 08:33:05 +0000 (UTC)
Message-Id: <20260615083304.7E10F1A923B@mollari.NetBSD.org>
Date: Mon, 15 Jun 2026 08:33:04 +0000 (UTC)
From: vezhlys@gmail.com
Reply-To: vezhlys@gmail.com
To: gnats-bugs@NetBSD.org
Subject: sysinst(8): partition list is incorrectly updated on UEFI mode when the swap partition is deleted
X-Send-Pr-Version: www-1.0
X-From4GNATS: "vezhlys@gmail.com via gnats" <gnats-admin@NetBSD.org>

>Number:         60334
>Category:       install
>Synopsis:       sysinst(8): partition list is incorrectly updated on UEFI mode when the swap partition is deleted
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    install-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 15 08:35:00 +0000 2026
>Closed-Date:    Tue Jul 07 21:41:04 +0000 2026
>Last-Modified:  Tue Jul 07 21:41:04 +0000 2026
>Originator:     Andrius V
>Release:        NetBSD 11.0 RC4
>Organization:
>Environment:
>Description:
I noticed an issue in sysinst on amd64 systems booting in UEFI mode after selecting "Use default partition sizes".
When the swap partition (the third partition) is deleted, the remaining two partitions become identical to the first partition.

On BIOS systems, the default partition layout contains only two partitions, and the issue could not be reproduced after creating and deleting a third partition.

By default it lists three partitions:
a: MSDOS (for uefi boot)
b: FFSv2ea / (root)
c: swap

Deleting the swap partition refreshes the list to two same MSDOS partitions:
a: MSDOS
b: MSDOS
(same offsets and sizes)

Deleting MSDOS or root partition works OK, the list stays correct.
>How-To-Repeat:
Boot on amd64 USB flash drive flash drive in (UEFI boot)

Select options:
Installation messages in English
unchanged
Install NetBSD to hard disk
Yes
sd0 (install disk in my case)
This is the correct geometry
Use default partition sizes
Delete swap partition
Observe two same MSDOS partitions (a/b).
>Fix:

>Release-Note:

>Audit-Trail:
From: Andrius V <vezhlys@gmail.com>
To: gnats-bugs@netbsd.org
Cc: install-manager@netbsd.org, gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Subject: Re: install/60334: sysinst(8): partition list is incorrectly updated
 on UEFI mode when the swap partition is deleted
Date: Mon, 15 Jun 2026 11:40:49 +0300

 On Mon, Jun 15, 2026 at 11:35=E2=80=AFAM vezhlys@gmail.com via gnats
 <gnats-admin@netbsd.org> wrote:
 >
 > >Number:         60334
 > >Category:       install
 > >Synopsis:       sysinst(8): partition list is incorrectly updated on UEF=
 I mode when the swap partition is deleted
 > >Confidential:   no
 > >Severity:       serious
 > >Priority:       medium
 > >Responsible:    install-manager
 > >State:          open
 > >Class:          sw-bug
 > >Submitter-Id:   net
 > >Arrival-Date:   Mon Jun 15 08:35:00 +0000 2026
 > >Originator:     Andrius V
 > >Release:        NetBSD 11.0 RC4
 > >Organization:
 > >Environment:
 > >Description:
 > I noticed an issue in sysinst on amd64 systems booting in UEFI mode after=
  selecting "Use default partition sizes".
 > When the swap partition (the third partition) is deleted, the remaining t=
 wo partitions become identical to the first partition.
 >
 > On BIOS systems, the default partition layout contains only two partition=
 s, and the issue could not be reproduced after creating and deleting a thir=
 d partition.
 >
 > By default it lists three partitions:
 > a: MSDOS (for uefi boot)
 > b: FFSv2ea / (root)
 > c: swap
 >
 > Deleting the swap partition refreshes the list to two same MSDOS partitio=
 ns:
 > a: MSDOS
 > b: MSDOS
 > (same offsets and sizes)
 >
 > Deleting MSDOS or root partition works OK, the list stays correct.
 > >How-To-Repeat:
 > Boot on amd64 USB flash drive flash drive in (UEFI boot)
 >
 > Select options:
 > Installation messages in English
 > unchanged
 > Install NetBSD to hard disk
 > Yes
 > sd0 (install disk in my case)
 > This is the correct geometry
 > Use default partition sizes
 > Delete swap partition
 > Observe two same MSDOS partitions (a/b).
 > >Fix:
 >

 Sorry, copy pasted the steps from the last bug report, in this case I
 was choosing not the install disk (ld0 or sd1).

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: install/60334: sysinst(8): partition list is incorrectly updated
 on UEFI mode when the swap partition is deleted
Date: Sun, 21 Jun 2026 23:00:39 +0200

 There is confusion between part_usage_info::flags (which takes
 the PUIFLG_* bits) and is filled like that by the default partition
 data, and part_usage_info::cur_flags which takes PTI_* bits
 from disk_part_info.

 However, label.c:renumber_partitions compares info.flags (that is:
 PTI_* bits) with pset->infos[i].flags (that is: PUIFLG_* bits).
 This obviously needs to check pset->infos[i].cur_flags instead.

 The code needs to be reviewed for other instances of this confusion.

 Martin

From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/60334 CVS commit: src/usr.sbin/sysinst
Date: Mon, 22 Jun 2026 19:36:47 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Jun 22 19:36:47 UTC 2026

 Modified Files:
 	src/usr.sbin/sysinst: label.c

 Log Message:
 PR 60334: fix two bugs:
  - confusion between part_usage_info::flags and ::cur_flags leading
    to not matching partitions properly when renumbering them after
    deletion
  - off by one corrupting memory when deleting a partition


 To generate a diff of this commit:
 cvs rdiff -u -r1.51 -r1.52 src/usr.sbin/sysinst/label.c

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

State-Changed-From-To: open->closed
State-Changed-By: andvar@NetBSD.org
State-Changed-When: Tue, 07 Jul 2026 21:41:04 +0000
State-Changed-Why:
fixed by martin and pulled up to netbsd-11

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.