summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2022-10-05 09:58:44 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2022-10-05 09:58:44 +0000
commit0a7e0d8541264c4905bb3bd9a37bba0627d9da1c (patch)
tree0b535b2026b99578c69618402d16f070a75e6f6a /usr.sbin
parent40081d2c25a4bfecda26f06b538e57a5300d7e92 (diff)
Skip softraid(4) keydisks
Keydisks appear as chunks internally (with special properties) and installboot(8) thus treated them like actual data chunks. Most users probably don't hit this as their keydisk is detached and thus appears "offline" and gets skipped. Installing to online keydisks may work but is neither expected nor intended to work, so properly skip them. Odd setups like keydisk and CRYPTO chunk on the same physical disk would end up installing getting bootblocks installed twice. Pointed out by Mikolaj Kucharski <mikolaj AT kucharski DOT name> who also provided the actual diff (minor wording tweaks by me) OK jsing
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/installboot/efi_softraid.c9
-rw-r--r--usr.sbin/installboot/i386_softraid.c9
-rw-r--r--usr.sbin/installboot/sparc64_softraid.c9
3 files changed, 24 insertions, 3 deletions
diff --git a/usr.sbin/installboot/efi_softraid.c b/usr.sbin/installboot/efi_softraid.c
index 79c46406b9c..ed1c6423387 100644
--- a/usr.sbin/installboot/efi_softraid.c
+++ b/usr.sbin/installboot/efi_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: efi_softraid.c,v 1.2 2022/08/29 18:54:43 kn Exp $ */
+/* $OpenBSD: efi_softraid.c,v 1.3 2022/10/05 09:58:43 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2022 Klemens Nanni <kn@openbsd.org>
@@ -54,6 +54,13 @@ sr_install_bootblk(int devfd, int vol, int disk)
return;
}
+ /* Keydisks always have a size of zero. */
+ if (bd.bd_size == 0) {
+ fprintf(stderr, "softraid chunk %u is keydisk - skipping...\n",
+ disk);
+ return;
+ }
+
if (strlen(bd.bd_vendor) < 1)
errx(1, "invalid disk name");
part = bd.bd_vendor[strlen(bd.bd_vendor) - 1];
diff --git a/usr.sbin/installboot/i386_softraid.c b/usr.sbin/installboot/i386_softraid.c
index b3ff06a6713..16ae394b146 100644
--- a/usr.sbin/installboot/i386_softraid.c
+++ b/usr.sbin/installboot/i386_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: i386_softraid.c,v 1.19 2022/08/29 18:54:43 kn Exp $ */
+/* $OpenBSD: i386_softraid.c,v 1.20 2022/10/05 09:58:43 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
* Copyright (c) 2010 Otto Moerbeek <otto@drijf.net>
@@ -65,6 +65,13 @@ sr_install_bootblk(int devfd, int vol, int disk)
return;
}
+ /* Keydisks always have a size of zero. */
+ if (bd.bd_size == 0) {
+ fprintf(stderr, "softraid chunk %u is keydisk - skipping...\n",
+ disk);
+ return;
+ }
+
if (strlen(bd.bd_vendor) < 1)
errx(1, "invalid disk name");
part = bd.bd_vendor[strlen(bd.bd_vendor) - 1];
diff --git a/usr.sbin/installboot/sparc64_softraid.c b/usr.sbin/installboot/sparc64_softraid.c
index 022b211c436..81fb199326a 100644
--- a/usr.sbin/installboot/sparc64_softraid.c
+++ b/usr.sbin/installboot/sparc64_softraid.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sparc64_softraid.c,v 1.6 2022/08/29 18:54:43 kn Exp $ */
+/* $OpenBSD: sparc64_softraid.c,v 1.7 2022/10/05 09:58:43 kn Exp $ */
/*
* Copyright (c) 2012 Joel Sing <jsing@openbsd.org>
*
@@ -55,6 +55,13 @@ sr_install_bootblk(int devfd, int vol, int disk)
return;
}
+ /* Keydisks always have a size of zero. */
+ if (bd.bd_size == 0) {
+ fprintf(stderr, "softraid chunk %u is keydisk - skipping...\n",
+ disk);
+ return;
+ }
+
if (strlen(bd.bd_vendor) < 1)
errx(1, "invalid disk name");
part = bd.bd_vendor[strlen(bd.bd_vendor) - 1];