From d55930ef1b6ad790e1b3c26e97731adb23b31473 Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 25 Apr 2023 14:48:16 +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. i386 BIOS. Crank minor. Tested inside amd64 vmm. --- sys/arch/i386/stand/boot/conf.c | 4 ++-- sys/arch/i386/stand/cdboot/conf.c | 4 ++-- sys/arch/i386/stand/libsa/biosdev.c | 4 +++- sys/arch/i386/stand/pxeboot/conf.c | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/sys/arch/i386/stand/boot/conf.c b/sys/arch/i386/stand/boot/conf.c index ab2cf8b81cd..f76ffad2c53 100644 --- a/sys/arch/i386/stand/boot/conf.c +++ b/sys/arch/i386/stand/boot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.76 2020/12/09 18:10:18 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.77 2023/04/25 14:48:16 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -42,7 +42,7 @@ #include #include "debug.h" -const char version[] = "3.44"; +const char version[] = "3.45"; int debug = 1; diff --git a/sys/arch/i386/stand/cdboot/conf.c b/sys/arch/i386/stand/cdboot/conf.c index 04444293a3b..e18d8ba325f 100644 --- a/sys/arch/i386/stand/cdboot/conf.c +++ b/sys/arch/i386/stand/cdboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.43 2020/12/09 18:10:18 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.44 2023/04/25 14:48:17 kn Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -43,7 +43,7 @@ #include #include "debug.h" -const char version[] = "3.44"; +const char version[] = "3.45"; int debug = 1; void (*sa_cleanup)(void) = NULL; diff --git a/sys/arch/i386/stand/libsa/biosdev.c b/sys/arch/i386/stand/libsa/biosdev.c index d4031c4608e..03f689d6271 100644 --- a/sys/arch/i386/stand/libsa/biosdev.c +++ b/sys/arch/i386/stand/libsa/biosdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: biosdev.c,v 1.100 2020/12/09 18:10:18 krw Exp $ */ +/* $OpenBSD: biosdev.c,v 1.101 2023/04/25 14:48:17 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -534,6 +534,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/i386/stand/pxeboot/conf.c b/sys/arch/i386/stand/pxeboot/conf.c index 81f0b6673b2..f022641757b 100644 --- a/sys/arch/i386/stand/pxeboot/conf.c +++ b/sys/arch/i386/stand/pxeboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.48 2020/12/09 18:10:18 krw Exp $ */ +/* $OpenBSD: conf.c,v 1.49 2023/04/25 14:48:17 kn Exp $ */ /* * Copyright (c) 2004 Tom Cosgrove @@ -45,7 +45,7 @@ #include "pxeboot.h" #include "pxe_net.h" -const char version[] = "3.44"; +const char version[] = "3.45"; int debug = 1; void (*sa_cleanup)(void) = pxe_shutdown; -- 2.20.1