From 4b81c2944f9321aabb43c275946f06c69bd7f723 Mon Sep 17 00:00:00 2001 From: kn Date: Tue, 25 Apr 2023 10:11:20 +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 EFI bits, other architectues to come. Crank minor. "seems sensible" jsing --- sys/arch/amd64/stand/efiboot/conf.c | 4 ++-- sys/arch/amd64/stand/efiboot/efidev.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/arch/amd64/stand/efiboot/conf.c b/sys/arch/amd64/stand/efiboot/conf.c index 81f2ece6185..ff714754c91 100644 --- a/sys/arch/amd64/stand/efiboot/conf.c +++ b/sys/arch/amd64/stand/efiboot/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.40 2023/01/02 22:41:17 kettenis Exp $ */ +/* $OpenBSD: conf.c,v 1.41 2023/04/25 10:11:20 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -40,7 +40,7 @@ #include "efidev.h" #include "efipxe.h" -const char version[] = "3.63"; +const char version[] = "3.64"; #ifdef EFI_DEBUG int debug = 0; diff --git a/sys/arch/amd64/stand/efiboot/efidev.c b/sys/arch/amd64/stand/efiboot/efidev.c index 5fb9413a1a7..191113670bc 100644 --- a/sys/arch/amd64/stand/efiboot/efidev.c +++ b/sys/arch/amd64/stand/efiboot/efidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: efidev.c,v 1.40 2022/09/01 13:45:26 krw Exp $ */ +/* $OpenBSD: efidev.c,v 1.41 2023/04/25 10:11:20 kn Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -567,6 +567,8 @@ efiopen(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) -- 2.20.1