summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorKlemens Nanni <kn@cvs.openbsd.org>2023-04-25 14:00:36 +0000
committerKlemens Nanni <kn@cvs.openbsd.org>2023-04-25 14:00:36 +0000
commit409bfd201a87879f1321fdae9778af18250ba7c5 (patch)
tree3cda340fd438a7d7f7e805812b3b871432476521 /sys
parent25db96c4156c8754ddc84bc9bbe4e8149f4d2956 (diff)
Do not attempt to write to read-only softraid
Bootloaders have no write support for softraid volumes, which manifests in, e.g. /bsd.upgrade not being stripped of its 'x' permission bit to prevent sysupgrade loops in case of upgrade failure. Set a no-write flag handled by libsa to bail out early in write calls. There should be no real behaviour change, writes just fail earlier now. sparc64 ofwboot. Crank minor. Tested on T4-2 guest domain with root on softraid.
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/sparc64/stand/ofwboot/ofdev.c5
-rw-r--r--sys/arch/sparc64/stand/ofwboot/vers.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/sys/arch/sparc64/stand/ofwboot/ofdev.c b/sys/arch/sparc64/stand/ofwboot/ofdev.c
index 4ab8b909315..e0fbf7a7385 100644
--- a/sys/arch/sparc64/stand/ofwboot/ofdev.c
+++ b/sys/arch/sparc64/stand/ofwboot/ofdev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ofdev.c,v 1.34 2022/09/01 13:45:26 krw Exp $ */
+/* $OpenBSD: ofdev.c,v 1.35 2023/04/25 14:00:35 kn Exp $ */
/* $NetBSD: ofdev.c,v 1.1 2000/08/20 14:58:41 mrg Exp $ */
/*
@@ -533,6 +533,9 @@ devopen(struct open_file *of, const char *name, char **file)
if (bootdev_dip) {
if (fname[0] == 's' && fname[1] == 'r' &&
'0' <= fname[2] && fname[2] <= '9') {
+ /* We only support read-only softraid. */
+ of->f_flags |= F_NOWRITE;
+
volno = fname[2];
if ('a' <= fname[3] &&
fname[3] <= 'a' + MAXPARTITIONS) {
diff --git a/sys/arch/sparc64/stand/ofwboot/vers.c b/sys/arch/sparc64/stand/ofwboot/vers.c
index 7494fde8a78..a94dcf18489 100644
--- a/sys/arch/sparc64/stand/ofwboot/vers.c
+++ b/sys/arch/sparc64/stand/ofwboot/vers.c
@@ -1 +1 @@
-const char version[] = "1.24";
+const char version[] = "1.25";