NetBSD Problem Report #59122

From www@netbsd.org  Mon Mar  3 15:33:19 2025
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)
	 client-signature RSA-PSS (2048 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id BC08B1A923A
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  3 Mar 2025 15:33:19 +0000 (UTC)
Message-Id: <20250303153318.5E95A1A923D@mollari.NetBSD.org>
Date: Mon,  3 Mar 2025 15:33:18 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: x86 efiboot can't handle >26 partitions
X-Send-Pr-Version: www-1.0

>Number:         59122
>Category:       port-amd64
>Synopsis:       x86 efiboot can't handle >26 partitions
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-amd64-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 03 15:35:00 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current, 10, 9, ...
>Organization:
The EFIv6 (128-partition space) Foundation
>Environment:
>Description:
x86 efiboot (and probably MI efiboot) is currently limited to 26 partitions, even though GPT can support many more than that.

Issues:

1. lib/biosdisk.c only enumerates 26 partitions:

    103 #define BIOSDISKNPART 26
    104 
    105 struct biosdisk {
    106 	struct biosdisk_ll ll;
    107 	daddr_t         boff;
    108 	daddr_t         size;
    109 	char            buf[BIOSDISK_BUFSIZE];
    110 #if !defined(NO_DISKLABEL) || !defined(NO_GPT)
    111 	struct biosdisk_partition part[BIOSDISKNPART];
    112 #endif
    113 };

https://nxr.netbsd.org/xref/src/sys/arch/i386/stand/lib/biosdisk.c?r=1.61#103

2. Syntax for specifying partitions only handles a-z:

    194 #define isvalidpart(c) ((c) >= 'a' && (c) <= 'z')
    195 		if (i < devlen) {
    196 			if (!isvalidpart(fname[i]))
    197 				return EPART;
    198 			p = fname[i++] - 'a';
    199 		}

https://nxr.netbsd.org/xref/src/sys/arch/i386/stand/efiboot/boot.c?r=1.23#194

   However, this can be circumvented by using `NAME=' syntax instead.  So maybe it's not that big a deal.

3. Other issues?

[Originally reported by Vladimir `phcoder' Serbinenko: https://mail-index.netbsd.org/tech-kern/2025/03/02/msg030103.html]
>How-To-Repeat:
try to efiboot NetBSD from a partition past the 26th one
>Fix:
1. bump BIOSDISKNPARTS
2. invent syntax for other partitions
3. ???
4. profit!

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-2025 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.