From 409bfd201a87879f1321fdae9778af18250ba7c5 Mon Sep 17 00:00:00 2001 From: Klemens Nanni Date: Tue, 25 Apr 2023 14:00:36 +0000 Subject: 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. --- sys/arch/sparc64/stand/ofwboot/ofdev.c | 5 ++++- sys/arch/sparc64/stand/ofwboot/vers.c | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'sys') 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"; -- cgit v1.2.3