NetBSD Problem Report #6947
Received: (qmail 14692 invoked from network); 5 Feb 1999 19:47:10 -0000
Message-Id: <199902051946.UAA13654@klic3.klicman.de>
Date: Fri, 5 Feb 1999 20:46:59 +0100 (MET)
From: Christoph Badura <bad@klicman.de>
Reply-To: bad@klicman.de
To: gnats-bugs@gnats.netbsd.org
Subject: sysinst can generate bogus disk labels because of swap defaults
X-Send-Pr-Version: 3.95
>Number: 6947
>Category: install
>Synopsis: sysinst can create disklabels with the swap partition extending beyond the end of the disc
>Confidential: no
>Severity: serious
>Priority: high
>Responsible: install-manager
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Fri Feb 05 11:50:02 +0000 1999
>Closed-Date: Wed Jun 11 22:24:57 +0000 2003
>Last-Modified: Wed Jun 11 22:24:57 +0000 2003
>Originator: Christoph Badura
>Release: 1.3I as of 1999/01/30 and 1.3.3 too.
>Organization:
>Environment:
System: NetBSD klic3.klicman.de 1.3I NetBSD 1.3I (BUFTEST) #127: Tue Feb 2 14:55:46 MET 1999 bad@klic3.klicman.de:/u/0/src/sys/arch/i386/compile/BUFTEST i386
>Description:
In md_make_bsd_partitions() the remaining space on the BSD partition isn't
been taken into account when the default swap partition size is computed.
>How-To-Repeat:
Start a 1.3.3 boot floppy, create a small NetBSD partition (say, 80MB),
select the custom installation partitioning option. Create a 60 MB root FS.
Select the default size for the swap partition (e.g. 32MB on i386).
Watch disklabel fail because the swap extends beyond the end of the 'c'
partition.
>Fix:
The following patch to sysinst fixes that problem for the "custom" layout
case. Note the patch to menuc/menu_sys.def at the end.
XXX md_make_bsd_partitions should be MI really and get defaults passed
in via parameters.
Index: defs.h
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/defs.h,v
retrieving revision 1.34
diff -r1.34 defs.h
64a65,69
> #ifndef MIN /* XXX some files pull in sys/param.h which defines this too */
> #define MIN(a,b) (((a)<(b))?(a):(b))
> #define MAX(a,b) (((a)<(b))?(a):(b))
> #endif
>
Index: arch/alpha/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/alpha/md.c,v
retrieving revision 1.8
diff -r1.8 md.c
159c159
< int i, part;
---
> int i, part, swapsz;
263,264c263,264
< i = NUMSEC(2 * (rammb < 32 ? 32 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 32 ? 32 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/arm32/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/arm32/md.c,v
retrieving revision 1.12
diff -r1.12 md.c
276c276
< int i, part;
---
> int i, part, swapsz;
394,395c394,395
< i = NUMSEC(4 * (rammb < 32 ? 32 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 4 * (rammb < 32 ? 32 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/bebox/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/bebox/md.c,v
retrieving revision 1.5
diff -r1.5 md.c
155c155
< int part;
---
> int part, swapsz;
254,255c254,255
< i = NUMSEC( 2 * (rammb < 16 ? 16 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 16 ? 16 : rammb)):
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/i386/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/i386/md.c,v
retrieving revision 1.19
diff -r1.19 md.c
155c155
< int part;
---
> int part, swapsz;
254,255c254,255
< i = NUMSEC( 2 * (rammb < 16 ? 16 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 16 ? 16 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/macppc/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/macppc/md.c,v
retrieving revision 1.5
diff -r1.5 md.c
160c160
< int i, part;
---
> int i, part, swapsz;
264,265c264,265
< i = NUMSEC(2 * (rammb < 32 ? 32 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 32 ? 32 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/pc532/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/pc532/md.c,v
retrieving revision 1.12
diff -r1.12 md.c
132c132
< int part, partsize, partstart, remain;
---
> int part, swapsz, partsize, partstart, remain;
228,229c228,229
< i = NUMSEC( 2 * (rammb < 16 ? 16 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 16 ? 16 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/pmax/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/pmax/md.c,v
retrieving revision 1.23
diff -r1.23 md.c
166a167
> int swapsz;
271,272c272,273
< i = NUMSEC(layoutkind * 2 * (rammb < 32 ? 32 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 32 ? 32 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/sparc/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/sparc/md.c,v
retrieving revision 1.7
diff -r1.7 md.c
159c159
< int remain;
---
> int remain, swapsz;
262,263c262,263
< i = NUMSEC(2 * (rammb < 32 ? 32 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 32 ? 32 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
Index: arch/vax/md.c
===================================================================
RCS file: /cvsroot/src/distrib/utils/sysinst/arch/vax/md.c,v
retrieving revision 1.2
diff -r1.2 md.c
163c163
< int remain;
---
> int remain, swapsz;
266,267c266,267
< i = NUMSEC(2 * (rammb < 32 ? 32 : rammb),
< MEG/sectorsize, dlcylsize) + partstart;
---
> swapsz = MIN(remain, 2 * (rammb < 32 ? 32 : rammb));
> i = NUMSEC(swapsz, MEG/sectorsize, dlcylsize) + partstart;
? menu_sys.defs
Plus this patch to usr.bin/menuc/menu_sys.def
Index: menu_sys.def
===================================================================
RCS file: /cvsroot/src/usr.bin/menuc/menu_sys.def,v
retrieving revision 1.15
diff -r1.15 menu_sys.def
96,97d95
< #define MAX(x,y) ((x)>(y)?(x):(y))
< #define MIN(x,y) ((x)<(y)?(x):(y))
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: gnats-admin->install-manager
Responsible-Changed-By: fair
Responsible-Changed-When: Thu Jun 17 13:56:04 PDT 1999
Responsible-Changed-Why:
This PR is the responsibility of the NetBSD install bug manager,
not the GNATS database administrator.
State-Changed-From-To: open->closed
State-Changed-By: dsl
State-Changed-When: Wed Jun 11 22:23:47 UTC 2003
State-Changed-Why:
Rototilled sysinst won't let partitions go beyond the end of the disk
>Unformatted:
(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.