NetBSD Problem Report #56893

From www@netbsd.org  Sun Jun 19 17:46:20 2022
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))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id 39A0D1A921F
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 19 Jun 2022 17:46:20 +0000 (UTC)
Message-Id: <20220619174618.BC0271A923C@mollari.NetBSD.org>
Date: Sun, 19 Jun 2022 17:46:18 +0000 (UTC)
From: code-netbsd@boerschig.net
Reply-To: code-netbsd@boerschig.net
To: gnats-bugs@NetBSD.org
Subject: Adding a NetBSD partition to existing GPT partitions fails in sysinst
X-Send-Pr-Version: www-1.0

>Number:         56893
>Category:       install
>Synopsis:       Adding a NetBSD partition to existing GPT partitions fails in sysinst
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    martin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Jun 19 17:50:00 +0000 2022
>Closed-Date:    Wed Aug 02 14:41:58 +0000 2023
>Last-Modified:  Wed Aug 02 14:41:58 +0000 2023
>Originator:     MB
>Release:        9.99.97
>Organization:
>Environment:
NetBSD 9.99.97 (GENERIC) amd64 Sat Jun 18 13:56:41 UTC 2022 

>Description:
Not sure if this is a supported installation type.
Trying to install here on a NVME with an existing GPT (1 EFI system partition, 1 Linux partition) on a laptop.
It fails in sysinst in the partitioning screen: 

the partition size is always invalid (looks like (int64_t)-1 with some values added, see below), sysinst reports "Too large!" for any value entered by the user, and "Invalid numeric" on entering -1.
The dialog pane reads something like:

Invalid Numeric!

Special values that can be entered for the size value:
   -1: use until the end
  a-b: use until the given partition

Size (max 18446744073709542912 MB) [18446744073709542912]: 
>How-To-Repeat:
First encountered on a laptop, can be reproduced in QEMU with similar partition setup:

#host
qemu-img create netbsd-current.img 20G
qemu-system-x86_64 -cdrom NetBSD-9.99.97-amd64.iso  -drive if=none,format=raw,file=netbsd-current.img,id=hd0,cache=writeback -device virtio-blk-pci,drive=hd0   -boot d

# In Qemu:
# exit sysinst
^C
# add the GPT partitions similar to the laptop's
gpt create /dev/ld0
gpt add -b 2k -i 1 -t efi -l efi_system -s 512M ld0
gpt add -i 2 -t linux-data -l some_linux -s 8G ld0

# go back to sysinst, try to add a partition after the linux-data partition
# e.g. new partition start: 8705 MB, size: until the end

^D 
>Fix:

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: install-manager->martin
Responsible-Changed-By: martin@NetBSD.org
Responsible-Changed-When: Sun, 19 Jun 2022 18:22:53 +0000
Responsible-Changed-Why:
take


From: "Martin Husemann" <martin@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56893 CVS commit: src/usr.sbin/sysinst
Date: Mon, 20 Jun 2022 16:06:38 +0000

 Module Name:	src
 Committed By:	martin
 Date:		Mon Jun 20 16:06:38 UTC 2022

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

 Log Message:
 PR 56893: fix input validation when the user moves a new partition to
 a totaly different part of the disk. Fix size handling for freshly
 added partitions (which would previously use random stack data due to
 bogus error checking).


 To generate a diff of this commit:
 cvs rdiff -u -r1.38 -r1.39 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->pending-pullups
State-Changed-By: martin@NetBSD.org
State-Changed-When: Mon, 20 Jun 2022 16:12:15 +0000
State-Changed-Why:
[pullup-9 #1476]


From: "SAITOH Masanobu" <msaitoh@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/56893 CVS commit: [netbsd-9] src/usr.sbin/sysinst
Date: Wed, 22 Jun 2022 23:48:54 +0000

 Module Name:	src
 Committed By:	msaitoh
 Date:		Wed Jun 22 23:48:54 UTC 2022

 Modified Files:
 	src/usr.sbin/sysinst [netbsd-9]: label.c

 Log Message:
 Pull up following revision(s) (requested by martin in ticket #1476):
 	usr.sbin/sysinst/label.c: revision 1.39
 PR 56893: fix input validation when the user moves a new partition to
 a totaly different part of the disk. Fix size handling for freshly
 added partitions (which would previously use random stack data due to
 bogus error checking).


 To generate a diff of this commit:
 cvs rdiff -u -r1.10.2.7 -r1.10.2.8 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: pending-pullups->closed
State-Changed-By: riastradh@NetBSD.org
State-Changed-When: Wed, 02 Aug 2023 14:41:58 +0000
State-Changed-Why:
fixed in HEAD (prior to 10 branch), pulled up to 9


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2023 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.