From 5a8378277327e8433b632bd9bef26d30b93e329c Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 25 Apr 2023 10:06:12 +0000 Subject: [PATCH] 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. amd64 BIOS bits first, rest to come. Crank minor. "seems sensible" jsing --- sys/arch/amd64/stand/boot/conf.c | 4 ++-- sys/arch/amd64/stand/cdboot/conf.c | 4 ++-- sys/arch/amd64/stand/libsa/biosdev.c | 4 +++- sys/arch/amd64/stand/pxeboot/conf.c | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/arch/amd64/stand/boot/conf.c b/sys/arch/amd64/stand/boot/conf.c index ac2bf3bd958..00176599d62 100644 --- a/sys/arch/amd64/stand/boot/conf.c +++ b/sys/arch/amd64/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.55 2022/08/12 20:18:58 stsp Exp $ */ +/* $OpenBSD: conf.c,v 1.56 2023/04/25 10:06:12 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -41,7 +41,7 @@ #include #include -const char version[] = "3.55"; +const char version[] = "3.56"; int debug = 1; diff --git a/sys/arch/amd64/stand/cdboot/conf.c b/sys/arch/amd64/stand/cdboot/conf.c index f376f5fffc0..654825fd64c 100644 --- a/sys/arch/amd64/stand/cdboot/conf.c +++ b/sys/arch/amd64/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.49 2022/08/12 20:18:58 stsp Exp $ */ +/* $OpenBSD: conf.c,v 1.50 2023/04/25 10:06:12 kn Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -42,7 +42,7 @@ #include #include -const char version[] = "3.55"; +const char version[] = "3.56"; int debug = 1; diff --git a/sys/arch/amd64/stand/libsa/biosdev.c b/sys/arch/amd64/stand/libsa/biosdev.c index 4e56de62c43..f669d169fd7 100644 --- a/sys/arch/amd64/stand/libsa/biosdev.c +++ b/sys/arch/amd64/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.35 2022/08/12 20:17:46 stsp Exp $ */ +/* $OpenBSD: biosdev.c,v 1.36 2023/04/25 10:06:12 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -533,6 +533,8 @@ biosopen(struct open_file *f, ...) #ifdef SOFTRAID /* Intercept softraid disks. */ if (strncmp("sr", dev, 2) == 0) { + /* We only support read-only softraid. */ + f->f_flags |= F_NOWRITE; /* Create a fake diskinfo for this softraid volume. */ SLIST_FOREACH(bv, &sr_volumes, sbv_link) diff --git a/sys/arch/amd64/stand/pxeboot/conf.c b/sys/arch/amd64/stand/pxeboot/conf.c index da7347520a4..290d50f001f 100644 --- a/sys/arch/amd64/stand/pxeboot/conf.c +++ b/sys/arch/amd64/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.54 2022/08/12 20:18:58 stsp Exp $ */ +/* $OpenBSD: conf.c,v 1.55 2023/04/25 10:06:12 kn Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -44,7 +44,7 @@ #include "pxeboot.h" #include "pxe_net.h" -const char version[] = "3.55"; +const char version[] = "3.56"; int debug = 0; void (*sa_cleanup)(void) = pxe_shutdown; -- 2.20.1